/* ═══════════════════════════════════════════════
   THE HYLAND GROUP — PERFORMANCE PORTAL
   Design System & Global Styles
═══════════════════════════════════════════════ */

/* Brittany Signature script font */
@font-face {
    font-family: 'Brittany';
    src: url('/static/fonts/Brittany.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ── Hyland Group Brand Palette ───────────────
       Light surfaces with dark text. CMA blue stays the primary accent;
       champagne gold reserved for logo badge.  */
    --bg-primary: #eaecf2;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f4f9;
    --bg-input: #ffffff;
    --bg-tertiary: #f3f5f9;
    --border: #d6dae3;
    --border-light: #e2e5ea;
    --text-primary: #0f172a;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #5b6573; /* WCAG AA: ~5:1 on --bg-primary (#eaecf2); was #94a3b8 (~3:1, failed AA) */
    --accent: #1E5FA8;
    --accent-light: #4A8FD4;
    --accent-dark: #154A87;
    --accent-glow: rgba(30, 95, 168, 0.12);
    --primary: #1E5FA8;
    --gold: #C9A028;
    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.10);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.10);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.10);
    --info: #0284c7;
    --info-bg: rgba(2, 132, 199, 0.10);
    --purple: #9333ea;
    --pink: #db2777;
    --teal: #0d9488;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(15,23,42,0.06), 0 4px 16px rgba(15,23,42,0.05);
    --shadow-lg: 0 4px 12px rgba(15,23,42,0.08), 0 12px 32px rgba(15,23,42,0.08);
    --transition: 0.2s ease;

    /* Aliases — older callers in JS still reference these names. Keep them
       mapped to current vars so undefined-var fallbacks (which used to
       render as transparent / unreadable) resolve correctly. */
    --surface: var(--bg-card);
    --surface-2: var(--bg-tertiary);
    --bg: var(--bg-primary);
    --card-bg: var(--bg-card);
    --border-color: var(--border);
    --hover-bg: var(--bg-hover);
    --error: var(--danger);
    --error-bg: var(--danger-bg);
    --text-primary-fallback: #0f172a;
}

/* ── Dark theme ───────────────────────────────────
   Activated by data-theme="dark" on <html>. Overrides only the base
   palette vars; aliases above are defined with var() so they cascade.
   Brand blue is brightened for legibility on dark surfaces; semantic
   colors are nudged lighter. CMA document + print styles intentionally
   stay light (they're client-facing deliverables, not portal chrome). */
:root[data-theme="dark"] {
    --bg-primary: #0f1117;
    --bg-secondary: #171a23;
    --bg-card: #1a1d27;
    --bg-hover: #242838;
    --bg-input: #20232f;
    --bg-tertiary: #1f2330;
    --border: #2c3140;
    --border-light: #242a37;
    --text-primary: #e8eaf0;
    --text: #e8eaf0;
    --text-secondary: #aab2c4;
    --text-muted: #8a93a6; /* WCAG AA (~4.6:1) on --bg-card */
    --accent: #4A8FD4;
    --accent-light: #6fa8e0;
    --accent-dark: #2f7fd1;
    --accent-glow: rgba(74, 143, 212, 0.18);
    --primary: #4A8FD4;
    --gold: #d4af37;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.16);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.16);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.16);
    --info: #38bdf8;
    --info-bg: rgba(56, 189, 248, 0.16);
    --shadow: 0 1px 3px rgba(0,0,0,0.45), 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.5), 0 12px 32px rgba(0,0,0,0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
h1, h2, h3 {
    font-family: 'Montserrat', 'Inter', -apple-system, sans-serif;
    letter-spacing: -0.01em;
}
a { color: var(--accent-light); text-decoration: none; }
input, textarea, select {
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    width: 100%;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Checkboxes + radios should NOT inherit the full-width padded-input style.
   Without this, ticking a box produces a huge empty rectangle next to a
   tiny glyph because the global rule above sets width:100% + padding. */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    margin: 0 6px 0 0;      /* small gap to the label text */
    accent-color: var(--accent);
    flex-shrink: 0;          /* don't let flex parents stretch these */
    cursor: pointer;
}
input[type="checkbox"]:focus,
input[type="radio"]:focus {
    box-shadow: none;
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
select option { background: var(--bg-card); }
textarea { resize: vertical; min-height: 80px; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

/* ─── Login ─────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(30,95,168,0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(30,95,168,0.04) 0%, transparent 50%);
    padding: 20px;
}
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 36px;
}
.logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: transparent;
    border: none;
    overflow: hidden;
    flex-shrink: 0;
}
.login-brand h1 { font-size: 20px; font-weight: 700; line-height: 1.2; font-family: 'Montserrat', 'Inter', sans-serif; letter-spacing: 0.01em; }
.login-brand p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.login-footer { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 24px; }
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%; padding: .7rem 1rem; border-radius: 8px;
    background: #fff; color: #3c4043; font-size: .9rem; font-weight: 500;
    border: 1px solid #dadce0; text-decoration: none; cursor: pointer;
    transition: box-shadow .15s, background .15s;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ─── App Layout ─────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-mark-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    overflow: hidden;
    flex-shrink: 0;
}
.brand-name { font-size: 14px; font-weight: 700; line-height: 1.2; font-family: 'Montserrat', 'Inter', sans-serif; letter-spacing: 0.01em; }
.brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-toggle { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 12px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* BETA badge on nav-items inside collapsible sections (2026-07-06).
   Excludes top-level items (they live directly under .sidebar-nav, not in
   a .nav-section-items) plus Coaching and Agent Resources (mature, no
   BETA marker needed). All other modules get a small blue "BETA" pill
   after the label to signal they're new/in-flux during rollout. */
.nav-section-items .nav-item::after {
    content: 'BETA';
    margin-left: auto;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--accent);
    border-radius: 3px;
    flex-shrink: 0;
}
#nav-sec-coaching .nav-item::after,
#nav-sec-resources .nav-item::after {
    content: none;
}
/* Per-item overrides — force BETA back on for specific items inside an
   otherwise-excluded section. */
#nav-sec-resources .nav-item[data-page="calculators"]::after {
    content: 'BETA';
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(30, 95, 168, 0.10);
    color: var(--accent-light);
    border-color: transparent;
    border-left: 2px solid var(--accent);
    padding-left: 10px;
}
.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 12px 4px;
}

/* Collapsible nav sections */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 12px 4px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.nav-section-header:hover {
    color: var(--text-secondary);
}
.nav-section-chevron {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    transform: rotate(-90deg);
}
.nav-section-header.open .nav-section-chevron {
    transform: rotate(0deg);
}
.nav-section-items {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    flex-shrink: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}
.nav-section-items.open {
    max-height: 1000px;
    opacity: 1;
}
.perm-hidden {
    display: none !important;
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ─── Avatar ─────────────────────────────────── */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
    overflow: hidden;
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; border-radius: 50%; }
.avatar-sm { width: 28px; height: 28px; font-size: 10px; border-radius: 50%; }

/* ─── Main Content ───────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    padding: 32px;
    max-width: 1400px;
}

/* iPad embedded mode — hide sidebar, full-width content */
body.ipad-mode .sidebar       { display: none !important; }
body.ipad-mode .main-content  { margin-left: 0 !important; padding: 20px !important; max-width: 100% !important; }
.page { display: none; }
.page.active { display: block; }

/* ─── Page Header ────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-left h2 { font-size: 26px; }
.page-header-left p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* ─── Cards ─────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-sm { padding: 16px; }
.card-hover { cursor: pointer; transition: all var(--transition); }
.card-hover:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ─── Stat Cards ─────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* Tightened 2026-07-06 — was 20px. Compact vertical rhythm lets more
       KPI tiles fit in the same gridstack area without truncation. */
    padding: 12px 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
}
.stat-icon {
    /* Was 40×40 with 12px bottom margin — trimmed for density. */
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    font-size: 15px;
}
.stat-value {
    /* Was 28px — headline stays the visual anchor but the tile height
       drops ~30% overall so more KPIs fit above the fold. */
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
}
/* A metric with no data yet — visually distinct from a real value/zero so
   "not wired up" doesn't read like a genuine 0. */
.stat-value.is-empty {
    color: var(--text-muted);
    font-weight: 600;
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-change {
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ─── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 700;
}
.btn-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-secondary {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-secondary);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary);
    padding: 6px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 18px; height: 18px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Grid Layouts ───────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ─── Agent Cards ────────────────────────────── */
.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.agent-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(30,95,168,0.15);
}
.agent-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.agent-card-info { flex: 1; min-width: 0; }
.agent-card-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.agent-card-meta { font-size: 12px; color: var(--text-secondary); }
.agent-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--success-bg);
    color: var(--success);
}

/* ─── Progress Bars ──────────────────────────── */
.progress-bar {
    background: var(--bg-hover);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.6s ease;
    background: var(--accent);
}
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* ─── Goal Items ─────────────────────────────── */
.goal-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}
.goal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.goal-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}
.goal-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.goal-stats { text-align: right; }
.goal-progress { font-size: 20px; font-weight: 800; line-height: 1; }
.goal-target { font-size: 12px; color: var(--text-secondary); }
.goal-pct { font-size: 12px; font-weight: 600; }

/* ─── Session Items ──────────────────────────── */
.session-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 10px;
}
.session-item:hover { border-color: var(--border-light); background: var(--bg-hover); }
.session-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.session-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* ─── Live Session Overlay ───────────────────── */
#live-session-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-primary, #0f1117);
    display: flex;
    flex-direction: column;
}
.live-session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-secondary, #1a1d27);
    border-bottom: 1px solid var(--border, #2a2d3a);
    flex-shrink: 0;
    gap: 12px;
}
.live-session-bar-left,
.live-session-bar-right { display: flex; align-items: center; gap: 8px; }
.live-session-bar-center { flex: 1; text-align: center; }
.live-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
    animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px #ef4444; }
    50%       { opacity: .5; box-shadow: 0 0 14px #ef4444; }
}
.live-session-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}
.live-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.live-notes-textarea {
    flex: 1;
    width: 100%;
    resize: none;
    font-size: 15px;
    line-height: 1.75;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border, #2a2d3a);
    background: var(--bg-secondary, #1a1d27);
    color: var(--text-primary, #e8eaf0);
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.live-notes-textarea:focus { border-color: var(--accent); }
.btn-danger {
    background: #ef4444 !important;
    color: #fff !important;
    border: none;
}

/* ─── Badges ─────────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.badge-purple { background: rgba(168,85,247,0.15); color: var(--purple); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--bg-hover); color: var(--text-secondary); }

/* ─── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-section { margin-bottom: 24px; }
.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ─── Table ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ─── Alerts ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert-error { background: var(--danger-bg); border-color: rgba(220,38,38,0.20); color: var(--danger); }
.alert-success { background: var(--success-bg); border-color: rgba(22,163,74,0.20); color: var(--success); }
.alert-info { background: var(--info-bg); border-color: rgba(2,132,199,0.20); color: var(--info); }
.alert-warning { background: var(--warning-bg); border-color: rgba(217,119,6,0.20); color: var(--warning); }

/* ─── Recording UI ───────────────────────────── */
.recording-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}
.record-btn {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px auto;
    font-size: 28px;
    transition: all 0.3s ease;
    background: var(--accent);
    color: white;
    box-shadow: 0 0 0 0 rgba(30,95,168,0.4);
}
.record-btn.recording {
    background: var(--danger);
    box-shadow: 0 0 0 8px rgba(239,68,68,0.2);
    animation: pulse-ring 1.5s infinite;
}
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.recording-timer {
    font-size: 36px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    margin: 8px 0;
}
.transcript-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    text-align: left;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text-primary);
}
.transcript-placeholder { color: var(--text-muted); font-style: italic; }

/* ─── Waveform visualization ─────────────────── */
.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin: 8px 0;
}
.waveform-bar {
    width: 4px;
    border-radius: 2px;
    background: var(--accent);
    transition: height 0.15s ease;
}

/* ─── Modal ──────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 20px;
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.2s ease;
}
@keyframes modal-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-lg { max-width: 860px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ─── Toast ──────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    pointer-events: auto;
    animation: toast-in 0.3s ease;
    max-width: 360px;
}
@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

/* ─── Tabs ───────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}
.tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text-primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
/* tab-btn: same style as .tab, usable as a <button> element */
.tab-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-btn.tab-btn-sub { padding: 7px 14px; font-size: 12px; }
.tab-btn.tab-btn-sub.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ── Swag store tabs — modern segmented-control styling (scoped) ──────────────
   These are <button class="tab"> elements; the global .tab style is an underline
   tab with no border/background reset, so the browser's default button chrome
   (gray fill, beveled border) leaked through and looked boxy. Restyle the track
   + pills here, scoped by id so no other page's tabs are affected. */
#swag-top-tabs,
#swag-cats {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: none;
    padding: 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    max-width: 100%;
}
#swag-top-tabs .tab,
#swag-cats .tab {
    border: none;
    border-bottom: none;
    background: transparent;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition);
}
#swag-top-tabs .tab:hover:not(.active),
#swag-cats .tab:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}
#swag-top-tabs .tab.active,
#swag-cats .tab.active {
    background: var(--bg-card);
    color: var(--accent-light);
    border-bottom: none;
    box-shadow: var(--shadow);
}

/* ─── Empty State ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; }
.empty-state .btn { margin-top: 14px; }
/* Compact variant for empty states inside a dashboard widget body (less tall
   than the full-page 60px padding, and vertically centered in the card). */
.empty-state.empty-state-widget {
    padding: 20px;
    height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.empty-state.empty-state-widget svg { width: 36px; height: 36px; margin-bottom: 10px; }
.empty-state.empty-state-widget h3 { font-size: 14px; }
.empty-state.empty-state-widget p  { font-size: 12.5px; }

/* ─── Spinner ────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
/* Alias used by ~9 pages (my_listings, missed_ops, training, etc.). Centered
   by default so `<div class="loading-spinner"></div>` renders nicely without
   extra wrapper markup. */
.loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: block;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Status pills ─────────────────────────────
   Reusable across listing status, transaction status, task status, etc.
   Base pill = neutral gray; semantic variants pull from --*-bg/--* tokens
   so they cascade correctly to dark mode. Keep in sync with .badge-* above
   — pills are for row-level status labels (short verbs/adjectives), badges
   are for metadata counts / tags. */
.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--bg-hover);
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.5;
}
.status-pill.status-active,
.status-pill.status-open,
.status-pill.status-completed,
.status-pill.status-closed-sale,
.status-pill.status-sold           { background: var(--success-bg); color: var(--success); }
.status-pill.status-pending,
.status-pill.status-in-progress,
.status-pill.status-active-under-contract,
.status-pill.status-under-contract { background: var(--warning-bg); color: var(--warning); }
.status-pill.status-coming-soon,
.status-pill.status-draft,
.status-pill.status-new            { background: rgba(147,51,234,0.12); color: var(--purple); }
.status-pill.status-expired,
.status-pill.status-withdrawn,
.status-pill.status-cancelled,
.status-pill.status-failed         { background: var(--danger-bg); color: var(--danger); }
.status-pill.status-closed,
.status-pill.status-archived,
.status-pill.status-inactive       { background: var(--info-bg); color: var(--info); }
/* Semantic aliases so callers can pick tone by intent rather than by
   status label. */
.status-pill.status-warning        { background: var(--warning-bg); color: var(--warning); }
.status-pill.status-success        { background: var(--success-bg); color: var(--success); }
.status-pill.status-danger         { background: var(--danger-bg); color: var(--danger); }
.status-pill.status-info           { background: var(--info-bg); color: var(--info); }
.status-pill.status-published      { background: var(--success-bg); color: var(--success); }

/* ─── Loading state wrapper ──────────────────────
   Standard container for a centered spinner + optional caption. Pairs with
   the .spinner or .loading-spinner classes above. */
.loading-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.loading-spinner-wrap .spinner {
    width: 28px; height: 28px;
    border-width: 3px;
    margin-bottom: 10px;
}

/* ─── Card interaction states ────────────────────
   Opt-in hover lift for clickable cards (roleplay tiles, course tiles,
   asset cards, etc.). Base .card is intentionally non-interactive. */
.card-hover {
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ─── Utility: numeric table columns ─────────────
   Apply to <th> and <td> that hold currency, counts, DOM, percentages —
   right-alignment is the professional convention and lets the eye scan
   magnitudes without decoration. */
.table-num, .col-num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ─── Dark-mode readability guard for hardcoded-light-bg elements ─
   The reports/owner_reports/etc. pages use ~189 hardcoded hex colors.
   Many cards use a hardcoded light background (#fff, #f8fafc, #eff6ff,
   #fff7ed) but never set their own text color — so they inherit
   var(--text-primary), which is LIGHT in dark mode. Result: light text
   on a white card = invisible.

   Rather than rewrite every hex to a CSS var (huge diff, high regression
   risk pre-rollout), force dark text on any dark-mode element whose
   INLINE style pins a light background. Covers the six most common
   variants seen in the grep on 2026-07-06. Adds !important to beat
   inline color rules that might also be light. */
:root[data-theme="dark"] [style*="background:#fff"],
:root[data-theme="dark"] [style*="background: #fff"],
:root[data-theme="dark"] [style*="background:#ffffff"],
:root[data-theme="dark"] [style*="background: #ffffff"],
:root[data-theme="dark"] [style*="background-color:#fff"],
:root[data-theme="dark"] [style*="background-color: #fff"],
:root[data-theme="dark"] [style*="background:#f8fafc"],
:root[data-theme="dark"] [style*="background: #f8fafc"],
:root[data-theme="dark"] [style*="background:#f9fafb"],
:root[data-theme="dark"] [style*="background: #f9fafb"],
:root[data-theme="dark"] [style*="background:#eff6ff"],
:root[data-theme="dark"] [style*="background: #eff6ff"],
:root[data-theme="dark"] [style*="background:#fef3c7"],
:root[data-theme="dark"] [style*="background: #fef3c7"],
:root[data-theme="dark"] [style*="background:#fff7ed"],
:root[data-theme="dark"] [style*="background: #fff7ed"],
:root[data-theme="dark"] [style*="background:#fee2e2"],
:root[data-theme="dark"] [style*="background: #fee2e2"],
:root[data-theme="dark"] [style*="background:#dcfce7"],
:root[data-theme="dark"] [style*="background: #dcfce7"],
:root[data-theme="dark"] [style*="background:#ede9fe"],
:root[data-theme="dark"] [style*="background: #ede9fe"] {
    color: #0f172a !important;
}
/* Descendants that don't have their own explicit color should also stay
   dark — but leave elements that DO specify their own color alone. This
   catches nested text/labels. */
:root[data-theme="dark"] [style*="background:#fff"] *:not([style*="color"]),
:root[data-theme="dark"] [style*="background: #fff"] *:not([style*="color"]),
:root[data-theme="dark"] [style*="background:#f8fafc"] *:not([style*="color"]),
:root[data-theme="dark"] [style*="background:#eff6ff"] *:not([style*="color"]),
:root[data-theme="dark"] [style*="background:#fff7ed"] *:not([style*="color"]) {
    color: #0f172a !important;
}

/* ─── Team Scorecard readability (added 2026-07-06) ─
   Wide dense table — 20+ columns, dozens of rows. Adds zebra striping,
   sticky first column (Metric name), sticky header row, hover highlight,
   tabular-nums for column alignment. Class-scoped to .sc-table so it
   doesn't leak to other tables on the reports page. */
.sc-table { border-collapse: separate; border-spacing: 0; }
.sc-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-hover);
}
.sc-table tbody tr:nth-child(odd)  { background: var(--bg-card); }
.sc-table tbody tr:nth-child(even) { background: var(--bg-tertiary); }
.sc-table tbody tr:hover           { background: var(--accent-glow); }
.sc-table tbody td, .sc-table thead th { border: none; }
.sc-table tbody td { padding: 8px 10px !important; font-variant-numeric: tabular-nums; }
.sc-table thead th { padding: 8px 10px !important; }
/* Sticky first column — Metric name stays visible on horizontal scroll. */
.sc-table thead th:first-child,
.sc-table tbody td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: inherit;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.08);
}
.sc-table thead th:first-child { z-index: 3; background: var(--bg-hover); }

/* ─── Signals page dark-mode overrides ─────────
   signals.js emits its own <style> block with ~40 hardcoded hex colors
   (background:#fff, background:#fafafa, background:#f9fafb, etc.) that
   don't respect data-theme. Rewriting that CSS-in-JS is a big diff;
   instead, target the signals-* classes here with high-specificity
   dark-mode overrides so cards/tables/chips read correctly in dark. */
:root[data-theme="dark"] .signals-card,
:root[data-theme="dark"] .signals-card-header,
:root[data-theme="dark"] .signals-chip,
:root[data-theme="dark"] .signals-table-wrap,
:root[data-theme="dark"] .signals-briefing {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
:root[data-theme="dark"] .signals-card-header {
    background: var(--bg-hover) !important;
    border-bottom-color: var(--border) !important;
}
:root[data-theme="dark"] .signals-chip.critical { background: var(--danger-bg) !important; border-color: var(--danger) !important; }
:root[data-theme="dark"] .signals-chip.warning  { background: var(--warning-bg) !important; border-color: var(--warning) !important; }
:root[data-theme="dark"] .signals-chip.ok       { background: var(--success-bg) !important; border-color: var(--success) !important; }
:root[data-theme="dark"] .signals-chip-val,
:root[data-theme="dark"] .signals-title,
:root[data-theme="dark"] .signals-briefing-text {
    color: var(--text-primary) !important;
}
:root[data-theme="dark"] .signals-badge {
    background: var(--bg-hover) !important;
    color: var(--text-secondary) !important;
}
:root[data-theme="dark"] .signals-badge.badge-warning  { background: var(--warning-bg) !important; color: var(--warning) !important; }
:root[data-theme="dark"] .signals-badge.badge-critical { background: var(--danger-bg)  !important; color: var(--danger)  !important; }
:root[data-theme="dark"] .signals-badge.badge-ai       { background: rgba(147,51,234,0.16) !important; color: var(--purple) !important; }
:root[data-theme="dark"] .signals-table th,
:root[data-theme="dark"] .signals-table td { color: var(--text-primary) !important; border-color: var(--border) !important; }
:root[data-theme="dark"] .signals-table thead { background: var(--bg-hover) !important; }
:root[data-theme="dark"] .signals-empty,
:root[data-theme="dark"] .signals-subtitle,
:root[data-theme="dark"] .signals-card-sub { color: var(--text-muted) !important; }

/* ─── Slack viewer polish (added 2026-07-06) ─────
   Slack-style hover: message rows highlight, and the "Reply" action pill
   only appears on hover (Slack's own convention). Cuts the visual noise
   of a persistent Reply button on every line. */
.slack-msg { transition: background 0.1s; }
.slack-msg:hover { background: var(--bg-hover); }
.slack-msg:hover .slack-msg-actions { display: flex !important; }
.slack-msg-actions button:hover { background: var(--bg-hover); }

/* Channel-list rows: flat clickable list, not tabs. Subtle hover + a
   small left-border marker on the active channel — clearly indicates
   "you're here" without the rounded-pill "tab" look. Border-radius
   removed to reinforce the flat-list feel. */
.slack-chan-btn {
    transition: background 0.1s, color 0.1s;
    border-radius: 0 !important;
    border-left: 3px solid transparent;
    padding-left: 12px !important;
}
.slack-chan-btn:hover { background: var(--bg-hover); }
.slack-chan-btn.active {
    background: var(--bg-hover);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
.slack-chan-btn.active > span { color: var(--accent); }
.loading-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    flex-direction: column;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── AI Summary Box ─────────────────────────── */
.ai-summary-box {
    background: linear-gradient(135deg, rgba(30,95,168,0.07), rgba(30,95,168,0.03));
    border: 1px solid rgba(30,95,168,0.18);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}
.ai-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-light);
    margin-bottom: 12px;
}
.ai-badge {
    background: var(--accent-glow);
    border: 1px solid rgba(30,95,168,0.3);
    color: var(--accent-light);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.06em;
}
.action-item-list { list-style: none; }
.action-item-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
}
.action-item-list li:last-child { border-bottom: none; }
.action-checkbox {
    width: 18px; height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.action-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

/* ─── Search ─────────────────────────────────── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    flex: 1;
    max-width: 360px;
}
.search-bar input {
    background: none;
    border: none;
    padding: 0;
    flex: 1;
    font-size: 13.5px;
}
.search-bar input:focus { box-shadow: none; }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ─── Misc ───────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent-light); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ─── Chart Container ────────────────────────── */
.chart-container { position: relative; height: 220px; }
.chart-container-lg { position: relative; height: 300px; }

/* ─── Color dots ─────────────────────────────── */
.dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* ─── Leaderboard ────────────────────────────── */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.rank {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-muted);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.rank.gold { color: #f59e0b; }
.rank.silver { color: #94a3b8; }
.rank.bronze { color: #b45309; }
.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name { font-size: 14px; font-weight: 600; }
.leaderboard-meta { font-size: 12px; color: var(--text-secondary); }
.leaderboard-value { font-size: 18px; font-weight: 800; }

/* Rank chip — filled circular badge for the top 3, plain number otherwise */
.leaderboard-rank {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
    flex-shrink: 0;
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.leaderboard-rank.gold   { background: var(--gold);    color: #fff; }
.leaderboard-rank.silver { background: #94a3b8;        color: #fff; }
.leaderboard-rank.bronze { background: #b45309;        color: #fff; }

/* Inline proportional bar under each leaderboard name */
.leaderboard-bar {
    height: 5px;
    border-radius: 3px;
    background: var(--bg-secondary);
    margin-top: 6px;
    overflow: hidden;
}
.leaderboard-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
}

/* Production leaderboard — full-roster auto-scroll ticker. .lb-scroll-track
   holds the rows; when the content overflows the card, JS duplicates it once
   and adds .lb-scrolling, which drives a translateY(-50%) loop — since the
   second copy is identical, the reset at 50% is invisible. Paused on hover
   so someone can actually read a row. */
.lb-scroll-viewport { position: relative; }
.lb-scroll-track.lb-scrolling {
    animation-name: lb-scroll-up;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.lb-scroll-viewport:hover .lb-scroll-track.lb-scrolling { animation-play-state: paused; }
@keyframes lb-scroll-up {
    from { transform: translateY(0); }
    to   { transform: translateY(-50%); }
}
.leaderboard-item-production { gap: 10px; }
.leaderboard-item-production .leaderboard-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-stats {
    display: flex;
    gap: 14px;
    flex-shrink: 0;
}
.lb-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
}
.lb-stat-value { font-size: 14px; font-weight: 800; }
.lb-stat-label { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

/* Cleaner native select — opt-in via class so it doesn't restyle every
   <select> in the app. Matches the height/weight of adjacent buttons. */
.select-clean {
    -webkit-appearance: none; appearance: none;
    background-color: var(--bg-card);
    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='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 28px 6px 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}
.select-clean:hover  { border-color: var(--accent); }
.select-clean:focus  { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

/* ─── Integration status ─────────────────────── */
.integration-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-dot.connected { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ─── Responsive ─────────────────────────────── */

/* Mobile top bar + drawer backdrop are hidden by default (desktop). */
.mobile-topbar { display: none; }
.mobile-nav-backdrop { display: none; }

/* ─── PWA install banner (floating top-center) ───────── */
.pwa-install-banner {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border: 1px solid var(--accent);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 0 0 4px rgba(99,102,241,0.18);
    width: calc(100% - 24px);
    max-width: 460px;
    animation: pwa-banner-in .35s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pwa-banner-in {
    from { opacity: 0; transform: translate(-50%, -12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.pwa-install-banner-inner {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
}
.pwa-install-banner .logo-mark-sm {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
}
.pwa-install-banner-text { flex: 1; min-width: 0; }
.pwa-install-banner .btn { flex-shrink: 0; }
#pwa-install-dismiss {
    padding: 6px 10px !important;
    min-width: 32px;
}

/* iOS instructions overlay — an arrow pointing to the Share button
   when the user is on Safari and we can't auto-install. The arrow
   points to the Share icon which lives in the bottom toolbar on
   iPhone (different position on iPad, but close enough). */
.pwa-ios-arrow {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1999;
    pointer-events: none;
    animation: pwa-arrow-bounce 1.4s ease-in-out infinite;
}
.pwa-ios-arrow svg {
    width: 40px; height: 40px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    color: var(--accent);
}
@keyframes pwa-arrow-bounce {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, 8px); }
}

/* Tablet */
@media (max-width: 900px) {
    .sidebar { width: 64px; }
    .sidebar .brand-name, .sidebar .brand-sub,
    .sidebar .nav-item span, .sidebar .user-details,
    .sidebar .nav-section-label, .sidebar .nav-section-header span { display: none; }
    .nav-item { justify-content: center; }
    .main-content { margin-left: 64px; padding: 20px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* Tablet dashboard grid (iPad-portrait range) — the 12-column gridstack would
   squeeze stat cards to ~130px and wrap their labels at this width, so reflow
   it into a wrapping flex layout: stat cards 2-up, larger widgets full-width.
   Mirrors the phone flatten pattern but keeps two columns for the small cards. */
@media (min-width: 641px) and (max-width: 900px) {
    .grid-stack {
        height: auto !important;
        display: flex; flex-wrap: wrap;
        gap: 12px; align-content: flex-start;
    }
    .grid-stack > .grid-stack-item {
        position: relative !important;
        left: 0 !important; top: 0 !important;
        transform: none !important;
        height: auto !important; min-height: 0 !important;
        width: 100% !important; margin: 0 !important;
    }
    .grid-stack > .grid-stack-item[gs-id^="stat-"] { width: calc(50% - 6px) !important; }
    .grid-stack > .grid-stack-item > .grid-stack-item-content {
        position: relative !important;
        inset: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    /* Drag-resize isn't usable on touch at this size — hide edit affordances. */
    #dash-edit-btn, #dash-add-widget-btn, #dash-reset-btn { display: none !important; }
    .grid-stack-item > .ui-resizable-handle { display: none !important; }
}

/* Narrow-desktop — laptop windows / half-screen browsers between the tablet
   cutoff and full-width. Same flex-wrap fallback as tablet but with 3 stat
   tiles per row instead of 2, and tighter label wrapping so we don't stack
   "TODAY'S POTENTIAL / EARNINGS" onto two lines. Added 2026-07-06 in
   response to a screenshot where at ~1200px the default 12-col gridstack
   left tiles tall + labels wrapped ugly. */
@media (min-width: 901px) and (max-width: 1300px) {
    .grid-stack {
        height: auto !important;
        display: flex; flex-wrap: wrap;
        gap: 12px; align-content: flex-start;
    }
    .grid-stack > .grid-stack-item {
        position: relative !important;
        left: 0 !important; top: 0 !important;
        transform: none !important;
        height: auto !important; min-height: 0 !important;
        width: 100% !important; margin: 0 !important;
    }
    /* 3-across for stat tiles; big widgets (goals, leaderboard) stay full-width. */
    .grid-stack > .grid-stack-item[gs-id^="stat-"] { width: calc(33.333% - 8px) !important; }
    .grid-stack > .grid-stack-item[gs-id="market-share"],
    .grid-stack > .grid-stack-item[gs-id="stat-active-listings"],
    .grid-stack > .grid-stack-item[gs-id="stat-active-share"] {
        width: calc(33.333% - 8px) !important;
    }
    .grid-stack > .grid-stack-item > .grid-stack-item-content {
        position: relative !important;
        inset: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    /* Keep labels on one line where possible — smaller font + tighter letter
       spacing rather than allowing them to wrap and inflate tile height. */
    .grid-stack .stat-label {
        font-size: 10.5px;
        letter-spacing: 0.03em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .grid-stack .stat-value { font-size: 20px; }
    .grid-stack .stat-icon { width: 28px; height: 28px; font-size: 14px; margin-bottom: 4px; }
    .grid-stack-item > .ui-resizable-handle { display: none !important; }
}

/* Phone — full PWA mobile layout with drawer sidebar */
@media (max-width: 640px) {
    /* Top bar visible on mobile only */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 52px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        padding: 0 14px;
        z-index: 90;
        padding-top: env(safe-area-inset-top);
        height: calc(52px + env(safe-area-inset-top));
    }
    .mobile-menu-btn {
        background: none; border: 0; padding: 8px; cursor: pointer;
        color: var(--text-primary); display: flex; align-items: center;
    }
    .mobile-topbar-brand {
        display: flex; align-items: center; gap: 10px;
        font-size: 15px; font-weight: 700;
    }

    /* Sidebar becomes a full-height drawer, hidden off-screen by default */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 2px 0 24px rgba(0,0,0,.5);
        padding-top: env(safe-area-inset-top);
    }
    .sidebar .brand-name, .sidebar .brand-sub,
    .sidebar .nav-item span, .sidebar .user-details,
    .sidebar .nav-section-label, .sidebar .nav-section-header span { display: inline; }
    .nav-item { justify-content: flex-start; }

    body.mobile-nav-open .sidebar { transform: translateX(0); }

    /* Backdrop when drawer is open */
    .mobile-nav-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        opacity: 0; pointer-events: none;
        transition: opacity .2s ease;
    }
    body.mobile-nav-open .mobile-nav-backdrop {
        display: block; opacity: 1; pointer-events: auto;
    }
    body.mobile-nav-open .sidebar { z-index: 100; }

    /* Main content shifts to account for top bar; no left margin */
    .main-content {
        margin-left: 0;
        padding: 14px;
        padding-top: calc(52px + env(safe-area-inset-top) + 14px);
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    /* Stack everything */
    .grid-2, .grid-3, .grid-4, .stat-grid { grid-template-columns: 1fr !important; gap: 12px; }
    .form-row { grid-template-columns: 1fr !important; }

    /* Larger touch targets */
    .btn, .nav-item, input, select, textarea { min-height: 44px; }
    .btn-sm { min-height: 36px; }

    /* Bottom-sheet style modals */
    .modal-overlay { align-items: flex-end; }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
    }

    /* Cards + headers: reduce padding for phone */
    .card { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    /* Tables collapse badly on phones — let them scroll */
    table { display: block; overflow-x: auto; max-width: 100%; }

    /* CMA wizard side-by-side map + candidates → stacked.
       inline styles win the specificity fight without !important, so we
       rely on the class being on the same element as the inline style
       and use !important to override the inline grid-template-columns. */
    .cma-wizard-grid { grid-template-columns: 1fr !important; min-height: 0 !important; }

    /* CMA detail modal 2-column grid (Pricing / Timeline / Property / Lot) */
    .cma-detail-grid { grid-template-columns: 1fr !important; gap: 16px !important; }

    /* Dashboard gridstack — force every widget to full-width stacked flow.
       Gridstack sets inline styles for position/size; override all of them
       so phones don't try to render a 12-column grid. */
    .grid-stack { height: auto !important; }
    .grid-stack > .grid-stack-item {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        transform: none !important;
        margin-bottom: 12px !important;
    }
    .grid-stack > .grid-stack-item > .grid-stack-item-content {
        position: relative !important;
        inset: 0 !important;
        overflow: visible !important;
    }
    /* Hide customize / reset / add-widget buttons on phone — drag-resize
       isn't usable with touch at this size. Read-only stacked view. */
    #dash-edit-btn, #dash-add-widget-btn, #dash-reset-btn { display: none !important; }

    /* Compete table — let it scroll horizontally but cap column widths so
       column 1 (metric label) stays readable. */
    table th, table td { white-space: nowrap; }

    /* Gridstack edit-mode resize/drag handles — visually suppress on phone */
    .grid-stack-item > .ui-resizable-handle { display: none !important; }

    /* ────────────────────────────────────────────────────────────────
       Mobile catch-alls — applies across every page to catch inline
       styles that would otherwise blow out the viewport on phones.
       Scoped to .main-content + modal containers so the CMA document,
       TV dashboards, and login screen aren't affected.
       ──────────────────────────────────────────────────────────────── */

    /* Any inline grid with multiple columns inside the main app area
       collapses to 1 column on phone. Covers 80+ call sites across
       goals, tasks, sessions, reporting, owner reports, recruiting,
       transactions, financials, marketing, ISA tracker, training,
       swag, etc. without per-file edits. */
    .main-content [style*="grid-template-columns"],
    .modal-overlay [style*="grid-template-columns"],
    [id$="-modal"] [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Chart.js canvases shrink to container */
    .main-content canvas,
    .card canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Embedded media never exceeds its container */
    .main-content img,
    .main-content iframe,
    .main-content video { max-width: 100%; height: auto; }

    /* Long strings (emails, URLs, client notes) don't blow the layout */
    .card, .main-content p, .main-content td, .main-content li {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Tab bars (Reporting, Settings, Users, etc.) scroll horizontally
       instead of wrapping badly. */
    [role="tablist"],
    .tab-bar, .tabs, .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }
    [role="tablist"]::-webkit-scrollbar,
    .tab-bar::-webkit-scrollbar { display: none; }

    /* flex-between + page-header pairs allow right-side content to wrap */
    .flex-between, .page-header { flex-wrap: wrap !important; }

    /* Button/action groups wrap cleanly */
    .main-content .btn-group,
    .main-content .action-group { flex-wrap: wrap; }

    /* Dashboard widget content — tighter padding */
    .grid-stack-item-content { padding: 14px !important; }

    /* ── Stat / KPI cards — the 4-up Reporting row (Closed Volume / Agent
       GCI / Office GCI / Period) plus dashboard stat tiles were wasting
       vertical space on phone. Compact: smaller headline, tighter padding. */
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 11px; }
    .stat-icon  { width: 32px; height: 32px; font-size: 15px; margin-bottom: 8px; }

    /* Grids that used repeat(3,...) or repeat(4,...) of KPI cards
       run 2-up on phone (better density than one-per-row). */
    .main-content [style*="grid-template-columns"][style*="repeat(4"],
    .main-content [style*="grid-template-columns"][style*="repeat(3"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* But if a card in that grid has a chart or table, let it span the
       full width so the content breathes. */
    .main-content [style*="grid-template-columns"][style*="repeat"] .card:has(canvas),
    .main-content [style*="grid-template-columns"][style*="repeat"] .card:has(table) {
        grid-column: 1 / -1;
    }

    /* Reporting KPI card headline value tightens up — many use inline
       text-align:center with a font-size:22px span that's too chunky. */
    .card[style*="text-align:center"] > div:first-child {
        font-size: 20px !important;
    }

    /* Data tables (Reporting agent lists, Compete comparison, etc.)
       smaller on phone with first-column sticky for horizontal scroll. */
    .data-table {
        font-size: 12px;
    }
    .data-table th, .data-table td {
        padding: 6px 8px !important;
        white-space: normal;
    }
    .data-table td:first-child, .data-table th:first-child {
        position: sticky; left: 0;
        background: var(--bg-card);
        z-index: 1;
    }

    /* Tighter breathing room on dashboard widget flex-between rows */
    .grid-stack-item-content .flex-between {
        gap: 8px;
        padding: 6px 0;
    }

    /* Card titles + header spacing shrink on phone */
    .card-title { font-size: 14px; }
    .card-header { margin-bottom: 12px; }

    /* Source badges (SS / MLS / FUB) compact to fit next to KPI labels */
    .src-badge, [class*="src-badge"] {
        display: inline-block;
        font-size: 9px !important;
        padding: 1px 5px !important;
        margin-left: 4px !important;
    }
}

/* ═══════════════════════════════════════════════
   Reports Page Layout (Owner Reports)
═══════════════════════════════════════════════ */

.or-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 24px;
    align-items: start;
}

/* Right sidebar: sticky, scrollable, never overlaps content */
.or-side-nav {
    position: sticky;
    top: 16px;
    align-self: start;
    border-left: 1px solid var(--border);
    padding-left: 14px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    z-index: 1;
}

.or-side-btn {
    display: block; width: 100%; text-align: left;
    padding: 7px 10px; border: 0; background: transparent;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    cursor: pointer; border-radius: 6px;
    transition: background .12s, color .12s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.or-side-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.or-side-btn.active {
    background: rgba(99,102,241,.12);
    color: var(--accent, #6366f1);
    font-weight: 600;
}
.or-side-section {
    font-size: 10px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted);
    padding: 14px 10px 4px;
}
.or-side-section:first-child { padding-top: 2px; }

/* Date range bar wraps on narrow headers */
#or-date-range {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
#or-from, #or-to {
    font-size: 12px; padding: 5px 8px; width: auto; min-width: 120px;
}

/* ── ≤ 1060 px: nav becomes a horizontal scrolling pill-tab bar ─── */
@media (max-width: 1060px) {
    .or-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    /* Nav floats ABOVE content when stacked */
    .or-side-nav {
        order: -1;
        position: static;
        max-height: none;
        border-left: none;
        padding-left: 0;
        overflow-y: visible;
        overflow-x: auto;
        border-bottom: 1px solid var(--border);
        padding-bottom: 12px;
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        z-index: auto;
    }
    .or-side-nav::-webkit-scrollbar { display: none; }
    /* Hide section labels — no room in horizontal mode */
    .or-side-section { display: none; }
    .or-side-btn {
        white-space: nowrap;
        flex-shrink: 0;
        width: auto;
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 5px 12px;
        font-size: 12px;
        text-overflow: unset;
        overflow: visible;
    }
    .or-side-btn.active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }
}

/* ── ≤ 640 px: compact pill tabs, tighter date range ─────────────── */
@media (max-width: 640px) {
    .or-side-btn { font-size: 11px; padding: 4px 10px; }
    #or-date-range { gap: 6px; }
    #or-from, #or-to { min-width: 100px; font-size: 11px; }
}

/* ═══════════════════════════════════════════════
   CMA Document Styles
═══════════════════════════════════════════════ */

/* ── CMA Document — Hyland Group Brand Styling ─── */
.cma-document {
    max-width: 920px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    color: #1a1a1a;
}
.cma-page {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 40px 44px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* ── Cover page — print-safe white design ─────── */
.cma-cover {
    background: #ffffff;
    color: #0f172a;
    min-height: 580px;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    position: relative;
    overflow: hidden;
    border-top: 6px solid #0d0d0d !important;
}

/* Cover body: left content + right photo */
.cma-cover-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.cma-cover-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 36px;
    min-width: 0;
}
.cma-cover-photo {
    width: 40%;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    min-height: 320px;
    position: relative;
    border-radius: 0 0 8px 0;
}
.cma-cover-photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 40%);
    border-radius: 0 0 8px 0;
}

/* ── Hero photo crop handles ────────────────────── */
.cma-crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #C9A84C;
    border: 2px solid #fff;
    border-radius: 2px;
    z-index: 10;
}

/* Top header bar — dark strip with logo */
.cma-cover-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #0d0d0d;
    padding: 20px 48px;
    margin-bottom: 40px;
}
.cma-logo-mark {
    width: 44px;
    height: 44px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: #C9A028;
    flex-shrink: 0;
}
.cma-logo-name {
    font-size: 18px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: .03em;
    color: #fff;
}
.cma-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    margin-top: 3px;
    letter-spacing: .02em;
}

/* Script tagline */
.cma-cover-tagline {
    font-family: 'Brittany', 'Dancing Script', cursive;
    font-size: 48px;
    font-weight: 400;
    color: #C9A028;
    margin: 0 48px 16px;
    padding-top: 32px;
    line-height: 1.2;
}

/* Main content */
.cma-cover-main { flex: 1; padding: 0 48px; }
.cma-cover-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 12px;
    font-family: 'Montserrat', sans-serif;
}
.cma-cover-address {
    font-size: 34px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -.01em;
    margin-bottom: 10px;
    text-transform: uppercase;
}
.cma-cover-location {
    font-size: 17px;
    color: #475569;
    font-weight: 500;
}
.cma-cover-sub {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Gold divider line */
.cma-cover-divider {
    width: 56px;
    height: 2px;
    background: #C9A028;
    margin: 24px 0;
}

/* Prepared for/by panel */
.cma-cover-meta {
    display: flex;
    gap: 40px;
    padding: 20px 48px 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 32px;
}
.cma-meta-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cma-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #94a3b8;
    font-weight: 600;
}
.cma-meta-value {
    font-size: 15px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: #0f172a;
}
.cma-cover-disclaimer {
    font-size: 10px;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 20px 48px 0;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* ── Section headers ──────────────────────────── */
.cma-section-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
    color: #1E5FA8;
    border-bottom: 2px solid #1E5FA8;
    padding-bottom: 7px;
    margin-bottom: 20px;
}

/* ── Property detail grid ─────────────────────── */
.cma-prop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 14px;
}
.cma-prop-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}
.cma-prop-cell span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #94a3b8;
    font-weight: 600;
}
.cma-prop-cell strong {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Montserrat', sans-serif;
}
.cma-features-row {
    font-size: 13px;
    color: #475569;
    margin-top: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #C9A028;
}
.cma-desc-row {
    font-size: 13px;
    color: #64748b;
    margin-top: 10px;
    line-height: 1.65;
}

/* ── Market stats ─────────────────────────────── */
.cma-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-bottom: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}
.cma-stat {
    text-align: center;
    padding: 18px 12px;
    border-right: 1px solid #e2e8f0;
    background: #fff;
}
.cma-stat:last-child { border-right: none; }
.cma-stat-val {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: #1E5FA8;
}
.cma-stat-label {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}
.cma-market-notes {
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid #1E5FA8;
    line-height: 1.6;
}

/* ── Comp tables ──────────────────────────────── */
.cma-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.cma-table th {
    background: #0d0d0d;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.7);
    padding: 9px 10px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
}
.cma-table th:first-child { border-radius: 6px 0 0 6px; }
.cma-table th:last-child  { border-radius: 0 6px 6px 0; }
.cma-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #334155;
}
.cma-table tr:hover td { background: #f8fafc; }
.cma-table tr:last-child td { border-bottom: none; }

/* ── Pricing page ─────────────────────────────── */
.cma-pricing-page { text-align: center; }
.cma-pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.cma-pricing-cell {
    border-radius: 12px;
    padding: 28px 20px;
}
.cma-pricing-low  { background: #f8fafc; border: 1px solid #e2e8f0; }
.cma-pricing-high { background: #f8fafc; border: 1px solid #e2e8f0; }
.cma-pricing-suggested {
    background: linear-gradient(145deg, #0d0d0d, #1a2a1a);
    color: #fff;
    transform: scale(1.03);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    border: 1px solid #C9A028;
}
.cma-pricing-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .10em;
    margin-bottom: 12px;
    color: #64748b;
    font-family: 'Montserrat', sans-serif;
}
.cma-pricing-suggested .cma-pricing-label { color: #C9A028; }
.cma-pricing-val {
    font-size: 30px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: #0f172a;
}
.cma-pricing-suggested .cma-pricing-val { color: #fff; font-size: 34px; }
.cma-pricing-ppsf {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    margin-top: 6px;
}
.cma-pricing-low .cma-pricing-ppsf,
.cma-pricing-high .cma-pricing-ppsf { color: #94a3b8; }
.cma-pricing-notes {
    font-size: 13px;
    color: #475569;
    background: #f8fafc;
    padding: 16px 20px;
    border-radius: 8px;
    line-height: 1.65;
    text-align: left;
    border-left: 3px solid #C9A028;
}

/* ── Footer / back cover — print-safe white ───── */
.cma-footer-page {
    text-align: center;
    background: #ffffff !important;
    color: #0f172a;
    padding: 0 !important;
    border-bottom: 6px solid #0d0d0d !important;
    overflow: hidden;
}
/* Dark bottom strip */
.cma-footer-page::before {
    content: '';
    display: block;
    background: #0d0d0d;
    height: 8px;
    width: 100%;
    margin-bottom: 48px;
}
.cma-footer-tagline {
    font-family: 'Brittany', 'Dancing Script', cursive;
    font-size: 52px;
    font-weight: 400;
    color: #C9A028;
    margin-bottom: 6px;
    line-height: 1.2;
}
.cma-footer-sub {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
    color: #94a3b8;
    margin-bottom: 32px;
}
.cma-footer-divider {
    width: 48px;
    height: 2px;
    background: #C9A028;
    margin: 0 auto 36px;
}
.cma-footer-brand {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e2e8f0;
}
.cma-footer-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 36px;
    padding: 0 44px;
}
.cma-footer-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 16px 8px;
    border-right: 1px solid #e2e8f0;
}
.cma-footer-stat:last-child { border-right: none; }
.cma-footer-stat strong {
    font-size: 30px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: #1E5FA8;
}
.cma-footer-stat span {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}
.cma-footer-contact {
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: .06em;
    padding-bottom: 8px;
}

/* ── Customizable Dashboard (Gridstack) ─────────────────────────────────── */

/* Widget card fills its grid cell */
.dash-widget-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
}

/* Widget body — content clips, no scrollbars */
.dash-widget-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Swag balance widget can have many credit buckets — let it scroll within the
   fixed widget height instead of clipping the bottom rows + the total. */
#ag-swag-content {
    overflow-y: auto;
}

/* Gridstack item content border radius + smooth sizing.
   Shadow lives on this wrapper (not the inner card) because the wrapper clips
   overflow, which would otherwise cut off a shadow set on the card itself. */
.grid-stack-item > .grid-stack-item-content {
    border-radius: var(--radius);
    overflow: hidden !important;
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
}
.grid-stack-item:hover > .grid-stack-item-content { box-shadow: var(--shadow-lg); }
.grid-stack-item .widget-inner { overflow: hidden; }
.grid-stack-item[gs-id^="stat-"] .stat-card { padding: 12px 16px; }
.grid-stack-item[gs-id^="stat-"] .stat-icon { width: 32px; height: 32px; margin-bottom: 6px; font-size: 15px; }
.grid-stack-item[gs-id^="stat-"] .stat-value { font-size: 22px; }
.grid-stack-item[gs-id^="stat-"] .stat-sub { font-size: 10px; }

/* Edit mode — dashed outline on widgets + grab cursor */
.dash-editing .grid-stack-item > .grid-stack-item-content {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    cursor: grab;
}
.dash-editing .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content {
    cursor: grabbing;
    opacity: 0.92;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3) !important;
}

/* Resize handle — accent corner tab */
.dash-editing .grid-stack-item > .ui-resizable-se {
    background: var(--accent) !important;
    border-radius: 0 0 var(--radius) 0;
    width: 14px !important;
    height: 14px !important;
    right: 0 !important;
    bottom: 0 !important;
    opacity: 0;
    transition: opacity .2s;
}
.dash-editing .grid-stack-item:hover > .ui-resizable-se {
    opacity: 1;
}

/* Gridstack placeholder cell */
.grid-stack-placeholder > .placeholder-content {
    background: var(--accent-glow) !important;
    border: 2px dashed var(--accent) !important;
    border-radius: var(--radius) !important;
}

/* ── Widget Picker Modal ──────────────────────────────────────────────────── */

#widget-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wp-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.wp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.wp-modal-title {
    font-size: 16px;
    font-weight: 700;
}

.wp-modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.wp-modal-close:hover { background: var(--border); color: var(--text); }

.wp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.wp-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.wp-body {
    padding: 8px 20px 12px;
}

.wp-section {
    margin-bottom: 20px;
}

.wp-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-top: 12px;
}

.wp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.wp-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    background: var(--bg-hover);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    text-align: center;
}
.wp-card:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-1px);
}

.wp-icon  { font-size: 28px; }
.wp-label { font-size: 13px; font-weight: 600; color: var(--text); }
.wp-desc  { font-size: 11px; color: var(--text-secondary); line-height: 1.3; }

/* Personal widget card wrapper (adds delete button) */
.wp-card-wrap {
    position: relative;
}
.wp-card-wrap .wp-card {
    width: 100%;
}
.wp-card-delete {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--error);
    color: #fff;
    border: 2px solid var(--bg-card);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
    z-index: 5;
    padding: 0;
}
.wp-card-wrap:hover .wp-card-delete {
    opacity: 1;
}

/* Quick links pill inside widget */
.wp-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background .15s, color .15s;
    border: 1px solid var(--border);
}
.wp-link-pill:hover {
    background: var(--accent-glow);
    color: var(--accent-light);
    border-color: var(--accent);
}

/* ── Print styles ── */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
    .sidebar, #sidebar, .app-layout > aside { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .cma-document { max-width: 100%; box-shadow: none; }
    .cma-page {
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 32px 44px !important;
        margin-bottom: 0 !important;
        page-break-after: always;
        break-after: always;
    }
    .cma-page:last-child { page-break-after: avoid; break-after: avoid; }
    .cma-cover { border-top: 6px solid #0d0d0d !important; padding-top: 0 !important; }
    .cma-cover-logo { padding: 16px 40px !important; }
    .cma-cover-photo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .cma-cover-tagline { margin: 0 40px 16px !important; padding-top: 32px !important; }
    .cma-cover-main { padding: 0 40px !important; }
    .cma-cover-meta { padding: 16px 40px 0 !important; }
    .cma-cover-disclaimer { margin: 16px 40px 0 !important; }
    /* Dark logo bar must print — small area, acceptable ink use */
    .cma-cover-logo, .cma-footer-page::before {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ── ISA Activity Tracker ─────────────────────────────────────────────────── */

.isa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.isa-table th {
    padding: 10px 10px 8px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: var(--bg-card);
}
.isa-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.isa-table tfoot tr:last-child td { border-bottom: none; }
.isa-cell-day {
    text-align: left !important;
    min-width: 130px;
    padding-left: 16px !important;
}
.isa-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.isa-row-today { background: rgba(30,95,168,.07); }
.isa-today-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 6px;
    vertical-align: middle;
}
.isa-row-totals {
    background: rgba(30,95,168,.06);
    border-top: 2px solid var(--border);
}
.isa-row-totals td { font-size: 14px; }
.isa-row-goal td {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}
.isa-row-goal td:first-child { padding-left: 16px; font-weight: 700; }
.isa-goal-hint {
    font-size: 10px;
    font-weight: 400;
    opacity: .65;
    display: block;
    margin-top: 2px;
    letter-spacing: 0;
}
.isa-hours-input {
    width: 58px;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}
.isa-hours-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.isa-tap-btn { transition: opacity .12s, transform .1s; }
.isa-tap-btn:hover { opacity: .85; }
.isa-tap-btn:active { transform: scale(.95); }

/* ── Print styles ────────────────────────────────────────────────────────── */
@media print {
    /* Hide everything except the report content */
    .sidebar, .topbar, .page-header, .tab-btn,
    .btn, button, select, input[type="date"],
    #rpt-lf-setup-msg, .print-hide {
        display: none !important;
    }

    body, .main-content, .page-content, #page-reporting {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .card {
        border: 1px solid #ccc !important;
        background: #fff !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 12px !important;
    }

    table { border-collapse: collapse !important; width: 100% !important; }
    th, td { border: 1px solid #ddd !important; padding: 4px 6px !important; font-size: 10px !important; }

    /* Force light colors for heatmap cells to be visible on paper */
    td[style*="background:rgb"] { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    .print-title {
        display: block !important;
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 8px;
        color: #000;
    }
}

.print-title { display: none; }

/* ═══════════════════════════════════════════════
   SOURCE BADGES — tiny pill next to reporting metrics
   indicating origin system (SS SkySlope / MLS / FUB FollowUpBoss)
═══════════════════════════════════════════════ */
.src-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 3px;
    letter-spacing: 0.3px;
    vertical-align: middle;
    margin-left: 6px;
    font-family: 'SF Mono', 'Monaco', monospace;
    border: 1px solid transparent;
    opacity: 0.85;
}
.src-badge.src-ss  { background: rgba(99, 102, 241, 0.15);  color: var(--accent-light); border-color: rgba(99, 102, 241, 0.35); }
.src-badge.src-mls { background: rgba(20, 184, 166, 0.15);  color: var(--teal);         border-color: rgba(20, 184, 166, 0.35); }
.src-badge.src-fub { background: rgba(245, 158, 11, 0.15);  color: var(--warning);      border-color: rgba(245, 158, 11, 0.35); }

/* ═══════════════════════════════════════════════
   AGENT LAUNCH HUB — 90-day onboarding tracker
═══════════════════════════════════════════════ */

/* Progress card */
.al-progress-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 32px 20px;
    margin: 0 0 32px;
}
.al-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}
.al-progress-pct {
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    font-family: 'Montserrat', sans-serif;
}
.al-progress-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}
.al-progress-counts {
    display: flex;
    gap: 24px;
}
.al-count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.al-count-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.al-count-sub {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.al-progress-bar-wrap {
    height: 10px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 16px;
}
.al-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--teal, #14b8a6) 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}
.al-phase-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.al-phase-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 12px;
}
.al-pill-label {
    font-weight: 600;
    color: var(--text-secondary);
}
.al-pill-pct {
    font-weight: 700;
    color: var(--accent);
}

/* Phase blocks */
.al-phase-block {
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.al-phase-blue  { background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.2); }
.al-phase-green { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.2); }
.al-phase-gold  { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.2); }
.al-phase-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.al-phase-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
    font-family: 'SF Mono', monospace;
}
.al-phase-blue  .al-phase-tag { color: #818cf8; }
.al-phase-green .al-phase-tag { color: #34d399; }
.al-phase-gold  .al-phase-tag { color: var(--warning); }
.al-phase-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
}
.al-phase-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.5;
    align-self: center;
}

/* Sections */
.al-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}
.al-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.al-section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.5;
}

/* Checklist items */
.al-checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.al-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}
.al-check-item:hover {
    background: var(--surface);
    border-color: var(--border);
}
.al-check-item.al-done {
    opacity: 0.7;
}
.al-check-item.al-done .al-check-label {
    text-decoration: line-through;
    color: var(--text-secondary);
}
.al-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.al-check-item.al-done .al-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}
.al-checkbox svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
}
.al-check-label {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

/* Staff cards */
.al-staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.al-staff-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.2s;
}
.al-staff-card.al-done {
    border-color: var(--success, #10b981);
}
.al-staff-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.al-staff-role {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}
.al-staff-date-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.al-date-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.al-date-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}
.al-date-input:focus {
    outline: none;
    border-color: var(--accent);
}
.al-staff-check {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success, #10b981);
}

/* Session cards */
.al-sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.al-session-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    transition: border-color 0.2s;
}
.al-session-card.al-done {
    border-color: var(--success, #10b981);
}
.al-session-header {
    margin-bottom: 12px;
}
.al-session-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.al-session-host {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}
.al-session-items {
    list-style: none;
    padding: 0;
    margin: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.al-session-items li {
    font-size: 12px;
    color: var(--text-secondary);
    padding-left: 16px;
    position: relative;
    line-height: 1.5;
}
.al-session-items li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 10px;
}

/* Course CTA */
.al-course-cta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.al-cta-icon {
    font-size: 32px;
    flex-shrink: 0;
}
.al-cta-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.al-cta-sub {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

@media (max-width: 640px) {
    .al-progress-header { flex-direction: column; }
    .al-progress-pct    { font-size: 36px; }
    .al-progress-counts { gap: 16px; }
    .al-staff-grid      { grid-template-columns: 1fr; }
    .al-sessions-grid   { grid-template-columns: 1fr; }
    .al-course-cta      { flex-direction: column; align-items: flex-start; }
}
.src-badge[title] { cursor: help; }

/* ═══════════════════════════════════════════════
   MY ONBOARDING — Agent Launch visual treatment
   (employee self-service view only; admin tabs unchanged)
═══════════════════════════════════════════════ */

/* Progress card */
.ob-my-progress-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 32px 20px;
    margin-bottom: 32px;
}
.ob-my-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.ob-my-welcome {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 4px;
}
.ob-my-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ob-my-pct-block { text-align: right; flex-shrink: 0; }
.ob-my-pct {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    font-family: 'Montserrat', sans-serif;
}
.ob-my-pct-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ob-my-count-row {
    display: flex;
    gap: 28px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.ob-my-count-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ob-my-count-n { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.ob-my-count-s { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.ob-my-bar-wrap {
    height: 10px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 14px;
}
.ob-my-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}
.ob-my-phase-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.ob-my-phase-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 12px;
}
.ob-my-pill-label { font-weight: 600; color: var(--text-secondary); }
.ob-my-pill-pct   { font-weight: 700; }

/* Phase banners */
.ob-my-phase-block {
    border-radius: 12px;
    padding: 18px 22px;
    margin: 28px 0 12px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.ob-phase-blue  { background: rgba(99, 102, 241, 0.08);  border: 1px solid rgba(99, 102, 241, 0.22); }
.ob-phase-green { background: rgba(16, 185, 129, 0.08);  border: 1px solid rgba(16, 185, 129, 0.22); }
.ob-phase-gold  { background: rgba(245, 158, 11, 0.08);  border: 1px solid rgba(245, 158, 11, 0.22); }
.ob-my-phase-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    font-family: 'SF Mono', monospace;
    margin-bottom: 3px;
}
.ob-phase-blue  .ob-my-phase-tag { color: #818cf8; }
.ob-phase-green .ob-my-phase-tag { color: #34d399; }
.ob-phase-gold  .ob-my-phase-tag { color: var(--warning); }
.ob-my-phase-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
}
.ob-my-phase-sub {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 480px;
    line-height: 1.5;
    align-self: center;
}

/* Task sections */
.ob-my-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 12px;
}
.ob-my-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.ob-my-section-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ob-my-section-count { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.ob-my-section-desc  { font-size: 12px; color: var(--text-secondary); margin: -6px 0 14px; line-height: 1.5; }
.ob-my-task-list { display: flex; flex-direction: column; }

/* Staff meeting grid cards */
.ob-my-staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.ob-my-staff-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s;
}
.ob-my-staff-card.ob-my-done { border-color: var(--success, #10b981); }
.ob-my-staff-name  { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ob-my-staff-time  { font-size: 11px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 4px; }
.ob-my-cal-link    { font-size: 11px; color: var(--accent); text-decoration: none; display: block; margin-top: 4px; }
.ob-my-staff-check { font-size: 11px; font-weight: 600; color: var(--success, #10b981); margin-top: 6px; }

/* Course CTA */
.ob-my-course-cta {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 28px 0 12px;
    flex-wrap: wrap;
}
.ob-my-cta-icon  { font-size: 30px; flex-shrink: 0; }
.ob-my-cta-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.ob-my-cta-sub   { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

@media (max-width: 640px) {
    .ob-my-progress-header { flex-direction: column; }
    .ob-my-pct             { font-size: 36px; }
    .ob-my-pct-block       { text-align: left; }
    .ob-my-count-row       { gap: 16px; }
    .ob-my-phase-block     { flex-direction: column; gap: 8px; }
    .ob-my-staff-grid      { grid-template-columns: 1fr 1fr; }
    .ob-my-course-cta      { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════
   Portal TO-DOs — Internal Roadmap (admin only)
   ═══════════════════════════════════════════════════════════ */

.ptodo-wrap { max-width: 1400px; margin: 0 auto; padding: 24px 20px 60px; }

.ptodo-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.ptodo-header-left { display: flex; flex-direction: column; gap: 8px; }
.ptodo-header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.ptodo-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.6rem; font-weight: 700; color: var(--text-primary); margin: 0;
}

.ptodo-launch-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff3cd; color: #856404; border: 1px solid #ffc107;
    border-radius: 20px; padding: 4px 12px; font-size: .8rem; font-weight: 600;
}

/* Filter buttons */
.ptodo-filter-group { display: flex; gap: 4px; background: var(--bg-secondary); border-radius: 8px; padding: 3px; }
.ptodo-filter {
    display: flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: none; border-radius: 6px; background: transparent; cursor: pointer;
    font-size: .82rem; font-weight: 500; color: var(--text-secondary); transition: all .15s;
}
.ptodo-filter.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* Avatars */
.ptodo-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%; font-size: .72rem; font-weight: 700;
}
.ptodo-avatar.matt    { background: #dbeafe; color: #1e40af; }
.ptodo-avatar.chelly  { background: #fce7f3; color: #9d174d; }
.ptodo-avatar.both    { background: #ede9fe; color: #5b21b6; }

.ptodo-add-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 16px;
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    cursor: pointer; font-size: .85rem; font-weight: 600;
}
.ptodo-add-btn:hover { opacity: .88; }

/* Column layout */
.ptodo-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }

.ptodo-col { border-radius: 12px; padding: 0; overflow: hidden; border: 1px solid var(--border-color); }
.ptodo-col-header { padding: 16px 16px 12px; }
.ptodo-col-launch  { border-top: 3px solid #f59e0b; }
.ptodo-col-active  { border-top: 3px solid #10b981; }
.ptodo-col-backlog { border-top: 3px solid #6b7280; }

.ptodo-col-title { font-weight: 700; font-size: .95rem; color: var(--text-primary); margin-bottom: 2px; }
.ptodo-col-sub   { font-size: .75rem; color: var(--text-secondary); margin-bottom: 8px; }
.ptodo-col-meta  { display: flex; align-items: center; gap: 8px; }

.ptodo-count { font-size: .75rem; color: var(--text-secondary); }
.ptodo-col-progress {
    flex: 1; height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden;
}
.ptodo-col-progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.ptodo-col-pct  { font-size: .72rem; color: var(--text-secondary); min-width: 28px; text-align: right; }

.ptodo-cards { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }

/* Cards */
.ptodo-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 14px; transition: box-shadow .15s;
}
.ptodo-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.ptodo-card-done { opacity: .6; }

.ptodo-card-top { margin-bottom: 10px; }
.ptodo-card-meta-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ptodo-card-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.ptodo-card:hover .ptodo-card-actions { opacity: 1; }

.ptodo-tag {
    font-size: .68rem; font-weight: 600; padding: 2px 7px;
    background: var(--bg-secondary); border-radius: 10px; color: var(--text-secondary);
}
.ptodo-assignee-label { font-size: .75rem; color: var(--text-secondary); }

.ptodo-card-title { font-size: .88rem; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.ptodo-card-desc  { font-size: .78rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }

.ptodo-icon-btn {
    border: none; background: transparent; cursor: pointer; padding: 2px 5px;
    font-size: .8rem; color: var(--text-secondary); border-radius: 4px;
}
.ptodo-icon-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Progress bar inside card */
.ptodo-progress-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ptodo-progress-bar-wrap { flex: 1; height: 5px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.ptodo-progress-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.ptodo-progress-bar-fill.done { background: #10b981; }
.ptodo-progress-label { font-size: .72rem; color: var(--text-secondary); white-space: nowrap; }

/* Tasks */
.ptodo-tasks { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow: hidden; }
.ptodo-tasks.ptodo-tasks-expanded { max-height: none; }

.ptodo-task {
    display: flex; align-items: flex-start; gap: 7px; padding: 5px 4px; border-radius: 5px;
    cursor: pointer; font-size: .8rem; color: var(--text-primary);
}
.ptodo-task:hover { background: var(--bg-secondary); }
.ptodo-task input[type="checkbox"] { margin-top: 1px; flex-shrink: 0; accent-color: var(--accent); }
.ptodo-task-text { flex: 1; line-height: 1.35; }
.ptodo-task-done .ptodo-task-text { text-decoration: line-through; color: var(--text-secondary); }
.ptodo-task-del {
    opacity: 0; border: none; background: transparent; cursor: pointer;
    color: var(--text-secondary); font-size: .75rem; padding: 0 3px; flex-shrink: 0;
}
.ptodo-task:hover .ptodo-task-del { opacity: 1; }

/* Card footer */
.ptodo-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.ptodo-add-task-btn {
    display: flex; align-items: center; gap: 4px; font-size: .75rem;
    color: var(--text-secondary); border: none; background: transparent; cursor: pointer; padding: 2px 4px;
}
.ptodo-add-task-btn:hover { color: var(--accent); }
.ptodo-card-expand {
    display: flex; align-items: center; gap: 4px; font-size: .72rem;
    color: var(--text-secondary); border: none; background: transparent; cursor: pointer; padding: 2px 6px;
}
.ptodo-card-expand:hover { color: var(--accent); }

/* Empty / loading / error */
.ptodo-empty { padding: 20px; text-align: center; color: var(--text-secondary); font-size: .82rem; }
.ptodo-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--text-secondary); }
.ptodo-error   { padding: 20px; color: #dc2626; font-size: .85rem; }

@media (max-width: 900px) {
    .ptodo-columns { grid-template-columns: 1fr; }
    .ptodo-header  { flex-direction: column; }
}

/* ── Portal TO-DOs modal ──────────────────────────────── */
.ptodo-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ptodo-modal {
    background: var(--bg-card); border-radius: 14px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.ptodo-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--border-color);
}
.ptodo-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.ptodo-modal-close {
    border: none; background: transparent; cursor: pointer; font-size: 1rem;
    color: var(--text-secondary); padding: 2px 6px; border-radius: 4px;
}
.ptodo-modal-close:hover { background: var(--bg-secondary); }
.ptodo-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ptodo-field-label { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.ptodo-field-input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border-color);
    border-radius: 7px; background: var(--bg-secondary); color: var(--text-primary);
    font-size: .88rem; box-sizing: border-box;
}
.ptodo-field-input:focus { outline: none; border-color: var(--accent); }

.ptodo-assignee-picker, .ptodo-col-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.ptodo-assignee-opt, .ptodo-col-opt {
    display: flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: 1px solid var(--border-color); border-radius: 20px; background: var(--bg-secondary);
    cursor: pointer; font-size: .8rem; color: var(--text-primary); transition: all .15s;
}
.ptodo-assignee-opt.active, .ptodo-col-opt.active {
    border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent); font-weight: 600;
}

.ptodo-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--border-color);
}
.ptodo-modal-cancel {
    padding: 8px 16px; border: 1px solid var(--border-color); border-radius: 7px;
    background: transparent; cursor: pointer; font-size: .85rem; color: var(--text-secondary);
}
.ptodo-modal-save {
    padding: 8px 18px; border: none; border-radius: 7px;
    background: var(--accent); color: #fff; cursor: pointer; font-size: .85rem; font-weight: 600;
}
.ptodo-modal-save:hover { opacity: .88; }

.ptodo-due-date { font-size: .72rem; color: var(--text-secondary); }

/* ── Portal TO-DOs: drag, assignee toggle, column popover ── */
.ptodo-assignee-toggle {
    cursor: pointer;
    border: none;
    padding: 0;
    background: none;
    transition: transform .15s, box-shadow .15s;
}
.ptodo-assignee-toggle:hover {
    transform: scale(1.18);
    box-shadow: 0 0 0 3px rgba(99,102,241,.35);
}

.ptodo-card[draggable="true"] { cursor: grab; }
.ptodo-card.ptodo-dragging {
    opacity: .45;
    transform: rotate(1.5deg) scale(.97);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    cursor: grabbing;
}

.ptodo-drop-indicator {
    height: 3px;
    border-radius: 2px;
    background: var(--primary, #6366f1);
    margin: 4px 0;
    pointer-events: none;
}

.ptodo-cards.ptodo-col-drag-over {
    background: rgba(99,102,241,.06);
    border-radius: 8px;
    outline: 2px dashed rgba(99,102,241,.35);
    outline-offset: -2px;
}

.ptodo-col-popover {
    position: absolute;
    z-index: 2000;
    background: var(--surface, #1e1e2e);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 160px;
}
.ptodo-col-popover button {
    background: none;
    border: none;
    color: var(--text-primary, #fff);
    padding: 8px 12px;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font-size: .85rem;
    white-space: nowrap;
}
.ptodo-col-popover button:hover {
    background: rgba(99,102,241,.15);
}

/* ── Portal TO-DOs: complete button ── */
.ptodo-complete-btn {
    margin-left: auto;
    background: none;
    border: 1.5px solid rgba(255,255,255,.15);
    border-radius: 20px;
    color: var(--text-secondary, #aaa);
    font-size: .75rem;
    padding: 3px 10px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.ptodo-complete-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34,197,94,.08);
}
.ptodo-complete-btn-on {
    border-color: #22c55e !important;
    color: #22c55e !important;
    background: rgba(34,197,94,.12) !important;
    font-weight: 600;
}

/* ── Portal TO-DOs: inline task edit ── */
.ptodo-task-text { cursor: text; }
.ptodo-task-edit-input {
    background: var(--surface-2, rgba(255,255,255,.07));
    border: 1.5px solid var(--primary, #6366f1);
    border-radius: 4px;
    color: var(--text-primary, #fff);
    font-size: inherit;
    padding: 1px 6px;
    width: 100%;
    outline: none;
}

/* ── Portal TO-DOs: comments ── */
.ptodo-comments-section { margin-top: 6px; }

.ptodo-comments { padding: 0 2px; }

.ptodo-cmnt-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.ptodo-comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.ptodo-comment-badge {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.ptodo-comment-badge.matt   { background: #6366f1; color: #fff; }
.ptodo-comment-badge.chelly { background: #ec4899; color: #fff; }
.ptodo-comment-badge.other  { background: rgba(255,255,255,.15); color: #ccc; }

.ptodo-comment-body { flex: 1; min-width: 0; }
.ptodo-comment-meta {
    display: flex; gap: 6px; align-items: center;
    font-size: .72rem; margin-bottom: 2px;
}
.ptodo-comment-author { font-weight: 600; color: var(--text-primary); }
.ptodo-comment-time   { color: var(--text-secondary); flex: 1; }
.ptodo-comment-del {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: .75rem; padding: 0 2px; opacity: 0;
    transition: opacity .15s;
}
.ptodo-comment:hover .ptodo-comment-del { opacity: 1; }
.ptodo-comment-text { font-size: .82rem; color: var(--text-primary); line-height: 1.4; word-break: break-word; }

.ptodo-mention { font-weight: 600; border-radius: 3px; padding: 0 3px; }
.ptodo-mention.matt   { background: rgba(99,102,241,.2); color: #a5b4fc; }
.ptodo-mention.chelly { background: rgba(236,72,153,.2); color: #f9a8d4; }
.ptodo-mention        { background: rgba(255,255,255,.1); color: #ccc; }

.ptodo-cmnt-compose {
    display: flex; gap: 6px; align-items: flex-end; margin-top: 4px;
}
.ptodo-cmnt-input {
    flex: 1; background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
    color: var(--text-primary); font-size: .82rem; padding: 6px 10px;
    resize: none; outline: none; line-height: 1.4; min-height: 32px;
    transition: border-color .15s;
}
.ptodo-cmnt-input:focus { border-color: var(--primary, #6366f1); }
.ptodo-cmnt-input::placeholder { color: var(--text-secondary); }

.ptodo-cmnt-send {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary, #6366f1); border: none; color: #fff;
    font-size: 1rem; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: opacity .15s;
}
.ptodo-cmnt-send:hover { opacity: .85; }

/* task comment toggle button */
.ptodo-task-comment-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: .75rem; cursor: pointer; padding: 0 2px; opacity: .5;
    transition: opacity .15s; display: flex; align-items: center; gap: 2px;
    white-space: nowrap;
}
.ptodo-task-comment-btn:hover,
.ptodo-task-comment-btn.has-comments { opacity: 1; }
.ptodo-task-comment-btn span { font-size: .7rem; font-weight: 600; }

.ptodo-task-wrap { display: flex; flex-direction: column; }
.ptodo-task-comments {
    margin: 2px 0 6px 28px;
    padding: 6px 8px;
    background: rgba(255,255,255,.03);
    border-radius: 6px;
    border-left: 2px solid rgba(255,255,255,.08);
}

/* @mention dropdown */
.ptodo-mention-dropdown {
    position: absolute; z-index: 3000;
    background: var(--surface, #1e1e2e);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 8px; padding: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    min-width: 140px;
}
.ptodo-mention-opt {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; width: 100%;
    color: var(--text-primary); padding: 7px 10px;
    border-radius: 5px; cursor: pointer; font-size: .85rem; text-align: left;
}
.ptodo-mention-opt:hover, .ptodo-mention-opt:focus { background: rgba(99,102,241,.15); outline: none; }

/* Power dialer collapsible setup cards */
#dialer-setup summary::-webkit-details-marker { display: none; }

/* ── Chrome-extension side panel (portal iframed in the dialer extension) ──
   Narrow viewport (~380-500px): no sidebar, no PWA banner, dialer console
   stacks into a single column with the lead card on top. */
html.panel-mode .sidebar { display: none !important; }
html.panel-mode .pwa-install-banner { display: none !important; }
html.panel-mode .main-content { margin-left: 0 !important; padding: 12px !important; max-width: 100% !important; }
html.panel-mode .page-header h1 { font-size: 20px; }
/* Call console: 3-column grid → stacked. Lead card first, dispositions second,
   queue + live notes last. */
html.panel-mode #dialer-console > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column;
    gap: 14px;
}
/* Reorder applies only to the 3-column single-lead console (270px queue col);
   the 2-column campaign console already stacks lead-card-first. */
html.panel-mode #dialer-console > div[style*="270px"] > div:nth-child(1) { order: 3; }
html.panel-mode #dialer-console > div[style*="270px"] > div:nth-child(2) { order: 1; }
html.panel-mode #dialer-console > div[style*="270px"] > div:nth-child(3) { order: 2; }
/* Setup cards stack full width in the narrow panel. */
html.panel-mode #dialer-setup > * { max-width: 100% !important; min-width: 0 !important; flex: 1 1 100% !important; }

/* ── Panel = focused dialing tool. Management lives on the desktop portal. ── */
/* No page title (the panel IS the dialer) */
html.panel-mode .page-header { display: none !important; }
/* Hide the management column: voicemail recording, templates, scripts, events */
html.panel-mode #dialer-setup > div[style*="flex-direction:column"] { display: none !important; }
/* Tighter cards + no wordy intro paragraphs */
html.panel-mode #dialer-setup > .card { padding: 14px !important; }
html.panel-mode #dialer-setup > .card > p.muted { display: none !important; }
html.panel-mode #dialer-setup h3 { font-size: 15px; margin-bottom: 2px; }
html.panel-mode #dialer-setup h4 { font-size: 14px; }
html.panel-mode #dialer-console .card { padding: 14px !important; }
/* In-call: hide the M/C/T live-notes coaching card (left column, 2nd card) and
   shorten the up-next list — the lead card and dispositions are the focus */
html.panel-mode #dialer-console > div[style*="270px"] > div:first-child > .card:nth-child(2) { display: none !important; }
html.panel-mode #dialer-console div[style*="max-height:270px"] { max-height: 150px !important; }

/* In-call console, panel mode: hide bulky non-essentials tagged panel-hide
   (session-timer cluster, per-outcome tallies, duplicate off-list dialer),
   and lay the disposition buttons out two per row. */
html.panel-mode .panel-hide { display: none !important; }
html.panel-mode #dialer-outcomes {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
html.panel-mode #dialer-outcomes .btn { font-size: 12px; padding: 8px 8px; }

/* Reports hub tab bar: scroll horizontally instead of wrapping to N rows */
.reports-tabbar .tab-btn { flex-shrink: 0; white-space: nowrap; }
.reports-tabbar { scrollbar-width: thin; }

/* Panel mode: no mobile topbar/hamburger — the panel is single-page */
html.panel-mode .mobile-topbar { display: none !important; }
html.panel-mode .mobile-nav-backdrop { display: none !important; }
html.panel-mode .main-content { padding-top: 12px !important; }

/* ── Mobile polish (UI/UX audit, 2026-07) ──────────────────────────
   Catch-all phone-width fixes so field agents aren't fighting the
   layout. Additive + mobile-only; desktop is unaffected. */
@media (max-width: 640px) {
    /* Inline filter inputs (reporting date pickers, etc.) stop forcing
       horizontal scroll — stack to full width. */
    .main-content [style*="min-width:200px"],
    .main-content [style*="min-width: 200px"] { min-width: 0 !important; width: 100% !important; }

    /* Dense stat grids (4/5/6/7-up) collapse to 2 columns instead of
       squeezing to unreadable slivers. */
    .main-content [style*="repeat(4"],
    .main-content [style*="repeat(5"],
    .main-content [style*="repeat(6"],
    .main-content [style*="repeat(7"] { grid-template-columns: repeat(2, 1fr) !important; }

    /* Tables wrap instead of forcing the whole page to scroll sideways. */
    .main-content table td,
    .main-content table th,
    .main-content [style*="white-space:nowrap"],
    .main-content [style*="white-space: nowrap"] { white-space: normal !important; }
    .main-content span[style*="min-width:72px"],
    .main-content span[style*="min-width:80px"] { min-width: 0 !important; }

    /* Toasts fit the viewport and clear the safe area. */
    .toast-container { right: 12px; left: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); }
    .toast { max-width: 100%; }

    /* Search bar and header actions use the full width / wrap. */
    .search-bar { max-width: 100% !important; }
    .page-header-actions { flex-wrap: wrap; }

    /* Lock body scroll while the nav drawer is open. */
    body.mobile-nav-open { overflow: hidden; }

    /* Modal leaves room for the soft keyboard and respects the notch. */
    .modal-overlay { padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    .modal-body { max-height: calc(100vh - 160px); overflow-y: auto; }
}
