:root {
    --bg: #f9fafb;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f3f4f6;
    --surface-soft: #f9fafb;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(124, 58, 237, 0.2);

    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --primary: #7c3aed;
    --primary-2: #6d28d9;
    --primary-hover: #8b5cf6;
    --primary-glow: rgba(124, 58, 237, 0.1);
    --primary-subtle: rgba(124, 58, 237, 0.05);

    --success: #16a34a;
    --success-subtle: rgba(34, 197, 94, 0.08);
    --warning: #d97706;
    --warning-subtle: rgba(245, 158, 11, 0.08);
    --danger: #dc2626;
    --danger-subtle: rgba(239, 68, 68, 0.08);

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SF Mono", "Fira Code", "JetBrains Mono", "Cascadia Code", monospace;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.06);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--primary-2); }

code {
    font-family: var(--mono);
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(124, 58, 237, 0.1);
    border-radius: var(--radius-xs);
    padding: 2px 8px;
    font-size: 0.84em;
    color: var(--primary);
}

::selection {
    background: rgba(124, 58, 237, 0.35);
    color: #fff;
}

.noise-overlay {
    display: none;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ===== Header ===== */
header {
    border-bottom: none;
    padding: 0;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
header h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
header h1 span {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header nav { display: flex; align-items: center; gap: 4px; }
header nav a {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    position: relative;
}
header nav a:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}
.nav-user {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all var(--transition);
}
.nav-user:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}
.app-layout.no-sidebar .main-content {
    padding-top: 40px;
    padding-bottom: 80px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 50;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    letter-spacing: -0.01em;
}
.sidebar-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    text-decoration: none;
}
.sidebar-link.active {
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary-hover);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--primary-hover), var(--primary));
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.4);
}
.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity var(--transition);
}
.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 0.9;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 14px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}
.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px 40px 80px;
    width: 100%;
    max-width: none;
}

/* ===== Page Hero ===== */
.page-hero {
    margin-bottom: 28px;
    padding: 28px;
    border-radius: var(--radius);
    border: none;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover), #06b6d4);
}
.page-hero::after {
    content: none;
}
.page-hero.compact { padding: 20px 24px; }
.page-hero h2 {
    font-size: 26px;
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -0.4px;
    margin-bottom: 6px;
    color: var(--text);
}
.page-hero p { max-width: 700px; position: relative; z-index: 1; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    margin-bottom: 12px;
    border-radius: 999px;
    border: none;
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.hero-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}
.hero-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}
.hero-metric {
    min-width: 140px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #ffffff;
    transition: all var(--transition);
}
.hero-metric:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.hero-label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}
.hero-metric strong {
    display: block;
    font-size: 24px;
    font-weight: 750;
    margin-top: 3px;
    letter-spacing: -0.5px;
}

.title-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.title-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-accent);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(124, 58, 237, 0.04));
    color: var(--primary-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.08);
}
.title-icon svg { width: 15px; height: 15px; }
.title-icon.sm { width: 24px; height: 24px; border-radius: var(--radius-xs); }
.title-icon.sm svg { width: 13px; height: 13px; }
.section-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin: -2px 0 18px;
}

/* ===== Cards ===== */
.card {
    background: #ffffff;
    border: none;
    border-radius: var(--radius);
    padding: 26px;
    margin-bottom: 22px;
    transition: all var(--transition-slow);
    position: relative;
    box-shadow: var(--shadow-sm);
}
.card::before {
    content: none;
}
.card:hover {
    box-shadow: var(--shadow);
}
.card:hover::before {
    content: none;
}
.card h2 {
    font-size: 16px;
    margin-bottom: 14px;
    font-weight: 650;
    letter-spacing: -0.15px;
}
.card h3 {
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== Forms ===== */
.form-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.form-group label {
    font-size: 12px;
    font-weight: 550;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}
.field-help {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}
.filter-group {
    min-width: 100%;
    padding: 18px;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(124, 58, 237, 0.02);
}
.filter-group legend {
    padding: 0 8px;
    font-size: 12px;
    font-weight: 650;
    color: var(--text-secondary);
    letter-spacing: 0.015em;
    text-transform: uppercase;
}
.choice-card-grid {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.choice-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.choice-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.03);
}
.choice-card input[type="radio"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.choice-card-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.choice-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.choice-card:has(input:checked) {
    border-color: rgba(124, 58, 237, 0.58);
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.15), rgba(124, 58, 237, 0.05));
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.24);
}
.choice-card:has(input:focus-visible) {
    outline: 2px solid rgba(124, 58, 237, 0.45);
    outline-offset: 2px;
}
.badge.badge-soft {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.12);
    box-shadow: none;
}

input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
    width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover {
    border-color: rgba(0, 0, 0, 0.2);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: #ffffff;
}
textarea { resize: vertical; min-height: 120px; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235b5b78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ===== Filter Checkboxes ===== */
.filter-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 14px 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.filter-checks-label {
    width: 100%;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.filter-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-secondary);
    user-select: none;
    transition: color var(--transition);
}
.filter-check:hover {
    color: var(--text);
}
.filter-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ===== Table Enhancements ===== */
tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

/* ===== Selection Counter ===== */
.selection-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--primary-subtle);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    transition: all var(--transition);
}
.selection-count:empty {
    display: none;
}

/* ===== Skeleton Loader ===== */
.skeleton {
    background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-hover) 50%, var(--surface-soft) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
    border-radius: var(--radius-xs);
}
.skeleton-row {
    height: 16px;
    margin-bottom: 12px;
    width: 100%;
}
.skeleton-row:nth-child(2) { width: 85%; }
.skeleton-row:nth-child(3) { width: 70%; }

/* ===== Credit Cost Tag ===== */
.credit-cost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.credit-cost svg {
    opacity: 0.5;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
    position: relative;
    letter-spacing: -0.01em;
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
    transition-duration: 50ms;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
    color: #fff;
    border: none;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 1px rgba(124, 58, 237, 0.5);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    box-shadow:
        0 4px 16px rgba(124, 58, 237, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 1px rgba(139, 92, 246, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    border: none;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(34, 197, 94, 0.4);
}
.btn-success:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow:
        0 4px 16px rgba(34, 197, 94, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 1px rgba(34, 197, 94, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #f87171, var(--danger));
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25), 0 0 0 1px rgba(239, 68, 68, 0.5);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
}
.btn-ghost:hover {
    border-color: rgba(0, 0, 0, 0.16);
    color: var(--text);
    background: rgba(0, 0, 0, 0.03);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    filter: grayscale(0.4);
}

/* ===== Table ===== */
.table-wrap {
    overflow-x: auto;
    margin-top: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #ffffff;
    position: relative;
}
.table-scroll-fade {
    position: sticky;
    right: 0;
    top: 0;
    width: 24px;
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    float: right;
    margin-left: -24px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(124, 58, 237, 0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    transition: all var(--transition);
}
.badge-success {
    background: rgba(22, 163, 74, 0.08);
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.15);
    box-shadow: none;
}
.badge-warning {
    background: rgba(217, 119, 6, 0.08);
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.15);
    box-shadow: none;
}
.badge-danger {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.15);
    box-shadow: none;
}
.badge-info {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.12);
    box-shadow: none;
}
.badge-google {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.15);
    box-shadow: none;
}
.badge-instagram {
    background: rgba(236, 72, 153, 0.08);
    color: #db2777;
    border-color: rgba(236, 72, 153, 0.15);
    box-shadow: none;
}

/* ===== Status Log ===== */
.status-log {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 240px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.9;
}
.status-log .entry { padding: 2px 0; }
.status-log .entry::before { content: "› "; color: var(--primary-hover); font-weight: 700; }

/* ===== Scrape Loader ===== */
.scrape-loader {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.scrape-loader-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.scrape-loader-head h3 {
    margin: 0 0 4px;
}
.scrape-loader-head .spinner {
    margin-top: 2px;
}
.scrape-shimmer-list {
    display: grid;
    gap: 10px;
}
.scrape-shimmer-row {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.04));
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}
.scrape-shimmer-row:nth-child(2) { width: 92%; }
.scrape-shimmer-row:nth-child(3) { width: 84%; }
.scrape-shimmer-row:nth-child(4) { width: 76%; }

/* ===== Checkbox ===== */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.stat {
    text-align: center;
    min-width: 130px;
    padding: 18px 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-slow);
}
.stat:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.stat:hover::before { opacity: 1; }
.stat .value {
    font-size: 30px;
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -0.6px;
}
.stat .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 550;
    margin-top: 5px;
}

.callout-panel {
    border-top: 1px solid var(--border);
    padding-top: 22px;
}
.outreach-panel-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: end;
}
.outreach-panel-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.outreach-panel-left .outreach-template-group {
    margin-bottom: 0;
    max-width: 340px;
}
.outreach-channel-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.outreach-channel-divider {
    width: 1px;
    height: 22px;
    background: var(--border-strong);
    margin: 0 4px;
}
.outreach-panel-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
    align-items: flex-end;
}
.outreach-panel-right > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.btn-bulk-gen {
    background: linear-gradient(135deg, rgba(234,88,12,0.85), rgba(217,119,6,0.85));
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15), 0 0 0 1px rgba(234,88,12,0.25);
    white-space: nowrap;
}
.btn-bulk-gen:hover {
    background: linear-gradient(135deg, rgba(234,88,12,1), rgba(217,119,6,1));
    box-shadow: 0 2px 6px rgba(234,88,12,0.3), 0 0 0 1px rgba(234,88,12,0.4);
}
.btn-wa {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15), 0 0 0 1px rgba(37,211,102,0.25);
}
.btn-wa:hover {
    box-shadow: 0 2px 6px rgba(37,211,102,0.3), 0 0 0 1px rgba(37,211,102,0.4);
}
.btn-ig {
    background: linear-gradient(135deg, #833AB4, #E1306C, #F77737);
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15), 0 0 0 1px rgba(131,58,180,0.25);
}
.btn-ig:hover {
    box-shadow: 0 2px 6px rgba(131,58,180,0.3), 0 0 0 1px rgba(131,58,180,0.4);
}
.btn-credit-tag {
    font-size: 10px;
    opacity: 0.65;
}
@media (max-width: 768px) {
    .outreach-panel-grid {
        grid-template-columns: 1fr;
    }
    .outreach-channel-divider {
        display: none;
    }
}
.outreach-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    column-gap: 14px;
    row-gap: 12px;
}
.outreach-template-group {
    margin-bottom: 0;
}
.outreach-actions-group {
    margin-bottom: 0;
    min-width: 320px;
}
.outreach-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.history-toolbar {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.history-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: min(100%, 320px);
    padding: 0 14px;
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.history-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.history-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: #ffffff;
}
.history-search input {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    min-height: 38px;
}
.history-search input:focus {
    box-shadow: none;
    background: transparent;
}
.history-toolbar .btn {
    align-self: stretch;
    min-height: 40px;
    padding: 0 16px;
}
.history-empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    padding: 28px 22px;
    text-align: center;
}
.history-empty-state h3 {
    margin-bottom: 8px;
}
.outreach-actions .btn,
.outreach-channel-row .btn {
    width: auto;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 12px;
    border-radius: var(--radius-xs);
}
.preview-shell {
    background: var(--bg);
    border-color: var(--border);
}

/* ===== Public Home ===== */
.public-home {
    max-width: 1220px;
    margin: 0 auto;
}
.public-hero {
    padding: 34px;
}
.public-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
    gap: 22px;
    align-items: stretch;
}
.public-hero-copy h2 {
    max-width: 760px;
    margin-bottom: 10px;
}
.public-hero-copy p {
    max-width: 760px;
}
.public-hero-cta {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.public-proof-row {
    margin-top: 18px;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.public-proof-row div {
    min-width: 110px;
}
.public-proof-row strong {
    display: block;
    font-size: 22px;
    font-weight: 760;
    line-height: 1.1;
    letter-spacing: -0.35px;
}
.public-proof-row span {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.public-hero-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.public-panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.public-panel-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.public-panel-metric {
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg);
    padding: 9px 10px;
}
.public-panel-metric span {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.public-panel-metric strong {
    display: block;
    margin-top: 2px;
    font-size: 21px;
    letter-spacing: -0.4px;
}
.public-panel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.public-panel-item {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.9);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
    flex-shrink: 0;
}
.dot.success {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}
.public-brand-strip {
    margin: 16px 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    text-align: center;
}
.public-brand-strip p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}
.public-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.public-feature-card {
    margin-bottom: 0;
    min-height: 220px;
}
.public-feature-card h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text);
}
.public-mini-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.public-mini-list li {
    color: var(--text-secondary);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.public-mini-list li::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-hover);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}
.public-steps {
    margin-top: 18px;
}
.public-steps h2 {
    margin-bottom: 16px;
}
.public-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.public-step {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    padding: 14px;
}
.public-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid var(--border-accent);
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary-hover);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
}
.public-step h4 {
    font-size: 14px;
    margin-bottom: 6px;
}
.public-step p {
    margin-bottom: 0;
}
.public-final-cta {
    margin-top: 18px;
    text-align: center;
}
.public-final-cta h2 {
    margin-bottom: 10px;
}
.public-final-cta p {
    margin: 0 auto;
    max-width: 680px;
}
.public-final-cta .public-hero-cta {
    justify-content: center;
}

/* ===== Animations ===== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(124, 58, 237, 0.15); }
    50% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.3); }
}

.animate-in {
    animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.active { display: flex; }
.modal-backdrop.active .modal {
    animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 580px;
    max-width: 92vw;
    max-height: 82vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal h2 {
    margin-bottom: 22px;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.2px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 1px; margin-bottom: 22px; }
.tab {
    padding: 8px 18px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: transparent;
    border: 1px solid var(--border);
    border-bottom: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.tab:hover { color: var(--text); background: rgba(0, 0, 0, 0.03); }
.tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(124, 58, 237, 0.2);
}

/* ===== Template Cards Grid ===== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}
.template-card {
    margin-bottom: 0;
}
.template-body-preview {
    white-space: pre-line;
    line-height: 1.55;
}

/* ===== Placeholder Pages ===== */
.placeholder-card {
    text-align: center;
    padding: 72px 24px;
}
.placeholder-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-accent);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.04));
    color: var(--primary-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.08);
    animation: pulse-glow 3s ease-in-out infinite;
}
.placeholder-icon svg { width: 26px; height: 26px; }
.placeholder-card h2 {
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
}

/* ===== Utilities ===== */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 550;
    z-index: 300;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1), transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-lg);
    border: 1px solid transparent;
    backdrop-filter: blur(12px);
}
.toast-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.toast-success {
    background: #dcfce7;
    border-color: rgba(22, 163, 74, 0.2);
    color: #166534;
    box-shadow: var(--shadow-lg);
}
.toast-error {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.2);
    color: #991b1b;
    box-shadow: var(--shadow-lg);
}

/* ===== Global Search Tracker ===== */
.global-search-tracker {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 250;
    width: 360px;
    max-width: calc(100vw - 48px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.gst-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}
.gst-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.gst-spinner { flex-shrink: 0; }
.gst-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.gst-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.gst-query {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.gst-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.gst-progress-bar {
    height: 2px;
    background: rgba(0, 0, 0, 0.05);
}
.gst-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 2px;
    transition: width 0.4s ease;
}
.gst-active .gst-progress-fill {
    width: 100%;
    animation: shimmer 1.6s linear infinite;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover), var(--primary));
    background-size: 200% 100%;
}
.gst-done {
    border-color: rgba(22, 163, 74, 0.2);
    box-shadow: var(--shadow-lg);
}
.gst-done .gst-title { color: #16a34a; }
.gst-done .gst-progress-fill {
    background: var(--success);
    animation: none;
}
.gst-failed {
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: var(--shadow-lg);
}
.gst-failed .gst-title { color: #dc2626; }
.gst-failed .gst-progress-fill {
    background: var(--danger);
    animation: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* ===== Global Polish & Micro-interactions ===== */

/* Focus-visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Button hover lift */
.btn:not(:disabled):hover {
    transform: translateY(-1px);
}
.btn:not(:disabled):active {
    transform: translateY(0);
}

/* Card subtle hover — upgrade shadow on hover */
.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Discovery card hover lift */
.discovery-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.discovery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Sidebar link smooth active transition */
.sidebar-link {
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* Sidebar section labels */
.sidebar-section-label {
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 20px 6px;
}

/* Email preview card styling */
.preview-email-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}
.preview-email-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}
.preview-email-header p {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.preview-email-header p:last-child {
    margin-bottom: 0;
}
.preview-email-header strong {
    color: var(--text);
    font-weight: 550;
}
.preview-email-body {
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Variable tag pills */
.var-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-family: var(--mono);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(124, 58, 237, 0.18);
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}
.var-pill:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(139, 92, 246, 0.14));
    border-color: rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}
.var-pill::before {
    content: '{{ ';
    opacity: 0.5;
    font-size: 10px;
}
.var-pill::after {
    content: ' }}';
    opacity: 0.5;
    font-size: 10px;
}

/* Password strength indicator */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.password-strength-bar {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s ease;
}
.password-strength-bar.active.weak { background: var(--danger); }
.password-strength-bar.active.medium { background: var(--warning); }
.password-strength-bar.active.strong { background: var(--success); }
.password-strength-label {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 550;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
        z-index: 90;
        background: var(--bg);
    }
    .sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
    }
    .sidebar-toggle {
        display: inline-flex;
    }
    .main-content {
        padding: 24px 18px 80px;
    }
}

@media (max-width: 760px) {
    .container { padding: 0 16px; }
    header nav { gap: 2px; }
    .card { padding: 18px; }
    .form-row .btn, .modal-actions .btn, .public-hero-cta .btn, .auth-card .btn { width: 100%; justify-content: center; }
    .btn-sm { width: auto; }
    .stats-bar { gap: 8px; }
    .stat { flex: 1; min-width: 100px; padding: 14px 16px; }
    .stat .value { font-size: 24px; }
    .page-hero { padding: 20px; }
    .page-hero h2 { font-size: 22px; }
    .hero-topline { align-items: flex-start; flex-direction: column; }
    .templates-grid { grid-template-columns: 1fr; }
    .main-content { padding: 20px 14px 64px; }
    .global-search-tracker { left: 12px; right: 12px; bottom: 12px; width: auto; }
    .gst-actions .btn { width: auto; }
    .var-pill { font-size: 11px; padding: 3px 8px; }
    .outreach-controls {
        grid-template-columns: 1fr;
    }
    .outreach-actions-group {
        min-width: 0;
    }
    .outreach-actions {
        justify-content: flex-start;
    }
    .outreach-actions .btn {
        width: 100%;
    }
    .public-hero {
        padding: 22px;
    }
    .public-hero-grid {
        grid-template-columns: 1fr;
    }
    .public-panel-metrics {
        grid-template-columns: 1fr 1fr;
    }
    .public-feature-grid {
        grid-template-columns: 1fr;
    }
    .public-steps-grid {
        grid-template-columns: 1fr;
    }
    .public-proof-row {
        gap: 12px;
    }
    .public-proof-row div {
        min-width: 92px;
    }
    .choice-card-grid {
        flex-direction: column;
    }
    .history-toolbar .btn {
        width: auto;
    }
    .history-search {
        width: 100%;
    }
    .discovery-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .discovery-searchbar {
        flex-direction: column;
    }
    .discovery-searchbar input {
        width: 100%;
    }
    .filter-checks {
        gap: 8px 14px;
    }
    .filter-check {
        font-size: 12.5px;
        min-width: calc(50% - 7px);
    }
}

.export-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 4px 0;
}
.export-dropdown.show {
    display: block;
}
.export-dropdown-item {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.export-dropdown-item:hover {
    background: rgba(124, 58, 237, 0.08);
    color: var(--text-primary);
}

/* ===== Generate Site Button & States ===== */
.gen-site-cell {
    min-width: 140px;
}
.gen-site-wrapper {
    display: flex;
    align-items: center;
}
.gen-site-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.gen-site-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(124, 58, 237, 0.08);
    opacity: 0;
    transition: opacity 200ms;
}
.gen-site-btn:hover {
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
    color: var(--primary-2);
}
.gen-site-btn:hover::before {
    opacity: 1;
}
.gen-site-btn:active {
    transform: translateY(0);
}
.gen-site-icon {
    display: flex;
    align-items: center;
}

/* Loading state */
.gen-site-loading {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
}
.gen-loading-bar {
    height: 3px;
    border-radius: 99px;
    background: rgba(139, 92, 246, 0.12);
    overflow: hidden;
}
.gen-loading-fill {
    height: 100%;
    width: 40%;
    border-radius: 99px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa, #7c3aed);
    background-size: 200% 100%;
    animation: genLoadingSlide 1.5s ease-in-out infinite;
}
@keyframes genLoadingSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
.gen-loading-text {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--primary-hover);
    letter-spacing: 0.01em;
    animation: genPulseText 1.5s ease-in-out infinite;
}
@keyframes genPulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Done state */
.gen-site-done {
    display: flex;
    gap: 4px;
    align-items: center;
}
.gen-site-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #16a34a;
    background: rgba(22, 163, 74, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.15);
    text-decoration: none;
    transition: all 180ms;
    white-space: nowrap;
}
.gen-site-view-btn:hover {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.25);
    color: #15803d;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.1);
}
.gen-site-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: all 180ms;
    white-space: nowrap;
}
.gen-site-preview-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    color: var(--text);
    transform: translateY(-1px);
}

/* Error state */
.gen-site-error {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Site Preview Modal ===== */
.site-preview-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 200ms ease-out;
}
.site-preview-backdrop.active {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.site-preview-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.site-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.site-preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-hover);
    font-size: 14px;
    font-weight: 600;
}
.site-preview-title span {
    color: var(--text);
}
.site-preview-actions {
    display: flex;
    gap: 8px;
}
.site-preview-device-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.device-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 180ms;
}
.device-btn:hover {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
}
.device-btn.active {
    color: var(--primary-hover);
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.2);
}
.site-preview-frame-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #f0f0f0;
    overflow: auto;
    padding: 0;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.site-preview-frame-wrap.device-desktop .site-preview-iframe {
    width: 100%;
    height: 100%;
}
.site-preview-frame-wrap.device-tablet {
    padding: 20px;
}
.site-preview-frame-wrap.device-tablet .site-preview-iframe {
    width: 768px;
    max-width: 100%;
    height: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}
.site-preview-frame-wrap.device-mobile {
    padding: 20px;
}
.site-preview-frame-wrap.device-mobile .site-preview-iframe {
    width: 390px;
    max-width: 100%;
    height: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}
.site-preview-iframe {
    border: none;
    width: 100%;
    height: 100%;
    background: #fff;
}

/* ===== Canva-Style Header Tabs ===== */
.header-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 28px;
}
.header-tab {
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
}
.header-tab:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}
.header-tab.active {
    color: var(--primary-hover);
}
.header-tab.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--primary-hover);
}

/* Hide sidebar on desktop when header tabs present */
@media (min-width: 901px) {
    .sidebar {
        display: none;
    }
    .sidebar-toggle {
        display: none !important;
    }
    .main-content {
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* ===== Discovery Hero (Canva-style) ===== */
.discovery-hero {
    position: relative;
    border-radius: var(--radius);
    padding: 56px 40px 52px;
    margin-bottom: 24px;
    overflow: hidden;
    text-align: center;
    border: none;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}
.discovery-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}
.hero-blob.blob-1 {
    width: 300px;
    height: 300px;
    top: -80px;
    left: -60px;
    background: #7c3aed;
    opacity: 0.08;
}
.hero-blob.blob-2 {
    width: 250px;
    height: 250px;
    top: -20px;
    right: -40px;
    background: #06b6d4;
    opacity: 0.08;
}
.hero-blob.blob-3 {
    width: 200px;
    height: 200px;
    bottom: -60px;
    left: 40%;
    background: #f59e0b;
    opacity: 0.08;
}
.discovery-hero-content {
    position: relative;
    z-index: 1;
}
.discovery-headline {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.15;
    margin-bottom: 12px;
    color: var(--text);
}
.headline-gradient {
    background: linear-gradient(135deg, #7c3aed, #6d28d9, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.discovery-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 520px;
    margin: 0 auto 28px;
    line-height: 1.55;
}
.discovery-searchbar {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 6px 6px 6px 20px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.discovery-searchbar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1), var(--shadow);
}
.discovery-searchbar svg {
    flex-shrink: 0;
    color: var(--text-muted);
}
.discovery-searchbar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    padding: 8px 0;
}
.discovery-searchbar input::placeholder {
    color: var(--text-muted);
}
.discovery-search-go {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition);
}
.discovery-search-go:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    transform: scale(1.05);
}

/* ===== Discovery Tabs ===== */
.discovery-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.discovery-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}
.discovery-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border-strong);
}
.discovery-tab.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(99, 102, 241, 0.08));
    border-color: rgba(124, 58, 237, 0.3);
    color: var(--primary-hover);
}
.discovery-tab svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.discovery-tab.active svg {
    opacity: 1;
}

/* ===== Discovery Cards Grid ===== */
.discovery-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.discovery-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 16px 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #ffffff;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.discovery-card:hover {
    background: #ffffff;
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.discovery-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    flex-shrink: 0;
}
.discovery-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* ===== Discovery Form Card ===== */
.discovery-form-card {
    margin-bottom: 32px;
}

/* ===== Responsive adjustments for discovery layout ===== */
@media (max-width: 900px) {
    .header-tabs {
        display: none;
    }
    .discovery-hero {
        padding: 36px 20px 32px;
    }
    .discovery-headline {
        font-size: 28px;
    }
    .discovery-subtitle {
        font-size: 14px;
    }
    .discovery-cards {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    .discovery-card {
        padding: 20px 12px 16px;
    }
    .discovery-card-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    .discovery-card-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* ===== Expandable Business Detail Rows (Reviews & Images) ===== */

.biz-expand-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 3px;
    color: var(--text-muted);
    transition: all 150ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.biz-expand-btn:hover {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.2);
}
.biz-expand-chevron {
    transition: transform 200ms ease;
}

.badge-enrichment {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
    color: var(--primary);
    font-weight: 500;
    border: 1px solid rgba(99,102,241,0.12);
}

.biz-detail-row td {
    padding: 0 !important;
    border-top: none !important;
}
.biz-detail-content {
    padding: 16px 20px 20px;
    background: linear-gradient(135deg, rgba(99,102,241,0.02), rgba(139,92,246,0.03));
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.biz-detail-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.biz-detail-heading {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.biz-detail-heading svg {
    color: var(--primary);
    opacity: 0.7;
}

/* Image Gallery */
.biz-image-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.biz-image-gallery::-webkit-scrollbar {
    height: 4px;
}
.biz-image-gallery::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.biz-image-thumb {
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 200ms ease, box-shadow 200ms ease;
    border: 1px solid var(--border);
}
.biz-image-thumb:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.biz-image-thumb img {
    height: 110px;
    width: auto;
    min-width: 120px;
    max-width: 200px;
    object-fit: cover;
    display: block;
}

/* Review Cards */
.biz-reviews-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.biz-reviews-list::-webkit-scrollbar {
    height: 4px;
}
.biz-reviews-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.review-card {
    flex-shrink: 0;
    width: 260px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 200ms ease;
}
.review-card:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}
.review-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.review-author {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
}
.review-stars {
    color: var(--warning);
    font-size: 12px;
    letter-spacing: 1px;
}
.review-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}
.review-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   Template Picker Modal
   ============================================ */
.tpl-picker-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.15s ease;
}
.tpl-picker-backdrop.active {
    display: flex;
}
.tpl-picker-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 780px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
.tpl-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tpl-picker-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}
.tpl-picker-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.tpl-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.tpl-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.tpl-picker-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}
.tpl-picker-confirm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.expiry-opt {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.expiry-opt:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.expiry-opt-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Template Cards */
.tpl-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
}
.tpl-card:hover {
    border-color: var(--text-tertiary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
.tpl-card-selected {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 1px var(--primary), 0 4px 16px rgba(124, 58, 237, 0.15) !important;
}
.tpl-card-recommended {
    border-color: rgba(124, 58, 237, 0.3);
}

/* Card Preview — Live iframe thumbnail */
.tpl-card-preview {
    position: relative;
    height: 140px;
    overflow: hidden;
    background: #f0f0f2;
}
.tpl-card-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 900px;
    border: none;
    transform: scale(0.15);
    transform-origin: top left;
    pointer-events: none;
}
.tpl-card-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    background: linear-gradient(135deg, #f5f5f7, #eeeef0);
    z-index: 1;
}
.tpl-badge-rec {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* Card Info */
.tpl-card-info {
    padding: 10px 12px 12px;
}
.tpl-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.tpl-card-desc {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 600px) {
    .tpl-picker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .tpl-picker-modal {
        max-height: 90vh;
    }
    .tpl-card-preview {
        height: 110px;
    }
    .tpl-card-iframe {
        transform: scale(0.12);
    }
    .tpl-picker-backdrop {
        padding: 1rem;
    }
}

/* =====================================================================
   SALES FUNNEL PIPELINE
   ===================================================================== */

.funnel-pipeline {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 16px;
    overflow-x: auto;
    padding: 2px 2px 6px;
}

.funnel-stage {
    flex: 1;
    min-width: 170px;
    background: var(--stage-bg);
    border: 1px solid color-mix(in srgb, var(--stage-color) 22%, var(--border));
    border-radius: 12px;
    padding: 12px 12px 10px;
    text-align: left;
    transition: all 200ms ease-out;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.funnel-stage-active {
    border-color: color-mix(in srgb, var(--stage-color) 45%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--stage-color) 35%, transparent), 0 8px 18px -14px color-mix(in srgb, var(--stage-color) 60%, transparent);
}

.funnel-stage-empty {
    opacity: 0.8;
    background: color-mix(in srgb, var(--stage-bg) 50%, var(--surface));
}

.funnel-stage-terminal {
    min-width: 130px;
}

.funnel-stage-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.funnel-stage-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--stage-color);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.funnel-stage-empty .funnel-stage-count {
    color: var(--text-muted);
}

.funnel-stage-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
    max-width: 90px;
}

.funnel-stage-bar-track {
    height: 6px;
    background: color-mix(in srgb, var(--stage-color) 12%, #fff);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.funnel-stage-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 400ms ease-out;
}

.funnel-stage-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.funnel-stage-pct {
    font-size: 10px;
    color: var(--text-secondary);
}

.funnel-stage-step {
    font-size: 10px;
    color: var(--text-muted);
}

.funnel-arrow {
    display: flex;
    align-items: center;
    padding: 0 2px;
    color: var(--text-muted);
    opacity: 0.45;
    flex-shrink: 0;
}

.funnel-conversion-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.funnel-conv-chip {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 5px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
}

.funnel-conv-chip strong {
    color: var(--text);
}

@media (max-width: 640px) {
    .funnel-pipeline {
        gap: 6px;
    }
    .funnel-stage {
        min-width: 145px;
        padding: 10px;
    }
    .funnel-stage-count {
        font-size: 21px;
    }
    .funnel-stage-label {
        font-size: 10px;
    }
    .funnel-arrow {
        display: none;
    }
    .funnel-arrow svg {
        width: 12px;
        height: 12px;
    }
}

/* =====================================================================
   REPLY ALERTS
   ===================================================================== */

.reply-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    text-align: center;
}

.reply-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.reply-alert-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--intent-border, var(--border));
    border-radius: 12px;
    padding: 12px;
    background: var(--surface);
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.reply-alert-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-strong);
}

.reply-alert-unread {
    background: rgba(124, 58, 237, 0.04);
    border-left-color: var(--intent-border, rgba(124, 58, 237, 0.4));
}

.reply-alert-intent {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.reply-alert-body {
    flex: 1;
    min-width: 0;
}

.reply-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.reply-alert-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.reply-alert-from {
    margin-top: 2px;
}

.reply-alert-subject {
    margin-top: 4px;
    font-weight: 500;
}

.reply-alert-preview {
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.reply-alert-actions {
    display: flex;
    gap: 6px;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 110px;
}

@media (max-width: 640px) {
    .reply-alert-card {
        flex-direction: column;
        gap: 8px;
    }
    .reply-alert-actions {
        flex-direction: row;
        min-width: unset;
    }
}

/* =====================================================================
   INTENT BADGES
   ===================================================================== */

.intent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.4;
}

.intent-badge svg {
    flex-shrink: 0;
}

/* =====================================================================
   REPLY THREAD MODAL
   ===================================================================== */

.thread-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread-msg {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.thread-msg-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.thread-msg-label-inbound {
    color: #6366f1;
}

.thread-msg-subject {
    font-size: 13px;
    color: var(--text);
}

.thread-msg-from {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}

.thread-msg-body {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 8px;
    color: var(--text);
    background: none;
    border: none;
    padding: 0;
}

.thread-msg-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.thread-suggestions {
    margin-top: 16px;
}

.thread-suggestions-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.thread-suggestion-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(99, 102, 241, 0.04);
}

.thread-suggestion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.thread-suggestion-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Funnel status badges for businesses table */
.funnel-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.funnel-status-lead {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.funnel-status-qualified {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.funnel-status-contacted {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.funnel-status-replied {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.funnel-status-won {
    background: rgba(22, 163, 74, 0.14);
    color: #16a34a;
}

.funnel-status-lost {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

/* Reply Inbox page styles */
.reply-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 16px;
    text-align: center;
}

.reply-alert-job-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(99, 102, 241, 0.15);
    transition: background 0.15s;
}

.reply-alert-job-chip:hover {
    background: rgba(99, 102, 241, 0.16);
}

.reply-thread-job-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.reply-thread-job-link:hover {
    background: rgba(99, 102, 241, 0.14);
}

.reply-composer {
    margin-top: 16px;
    border: 1px solid var(--border-accent);
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.06), rgba(124, 58, 237, 0.03));
}

.reply-composer-title {
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
}

.reply-composer-hint {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

.reply-composer input,
.reply-composer textarea {
    background: rgba(255, 255, 255, 0.92);
}

.reply-composer textarea {
    resize: vertical;
    min-height: 150px;
}

.reply-composer-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.reply-composer-status {
    min-height: 20px;
    margin-top: 6px;
}
