/* LeadTracker by DPOM - Branded */
:root {
    --primary: #0891B2;
    --primary-light: #22D3EE;
    --primary-dark: #0E7490;
    --primary-bg: #CFFAFE;
    --accent-yellow: #FFBA00;
    --accent-green: #5DB055;
    --accent-blue: #3086CB;
    --success: #5DB055;
    --success-bg: #E8F5E6;
    --warning: #FFBA00;
    --warning-bg: #FFF6D9;
    --danger: #0891B2;
    --danger-bg: #CFFAFE;
    --gray-50: #F9FAFB;
    --gray-100: #F4F4F4;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #7A7A7A;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1C1D21;
    --gray-900: #1a1a2e;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Raleway', 'Montserrat', -apple-system, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6, .card-title, .stat-label, .sidebar-logo {
    font-family: 'Montserrat', 'Raleway', -apple-system, sans-serif;
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: white;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-logo {
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.sidebar-logo img { height: 32px; width: auto; }
.sidebar-logo .logo-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    margin-top: 6px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: white;
}
.sidebar-nav a.active { border-right: 3px solid var(--primary); }
.sidebar-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 15px 20px 5px;
    font-weight: 600;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

.top-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-bar h1 { font-size: 18px; font-weight: 700; }
.top-bar-right { display: flex; align-items: center; gap: 15px; }

.page-content { padding: 25px 30px; }

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 18px 20px;
}
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-value.green { color: var(--success); }
.stat-value.blue { color: var(--primary); }
.stat-change { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 12px;
    border-bottom: 2px solid var(--gray-200);
}
td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}
tr:hover td { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.badge-new { background: #DBEAFE; color: #1E40AF; }
.badge-contacted { background: var(--warning-bg); color: #92400E; }
.badge-qualified { background: var(--success-bg); color: #065F46; }
.badge-won { background: #D1FAE5; color: #065F46; }
.badge-lost { background: var(--danger-bg); color: #991B1B; }
.badge-ppc { background: #DBEAFE; color: #1E40AF; }
.badge-organic { background: #D1FAE5; color: #065F46; }
.badge-social { background: #FCE7F3; color: #9D174D; }
.badge-direct { background: var(--gray-100); color: var(--gray-600); }
.badge-email { background: #FEF3C7; color: #92400E; }
.badge-referral { background: #E0E7FF; color: #3730A3; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* Notifications bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.15s;
}
.notification-bell:hover { background: var(--gray-100); }
.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notification-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    width: 360px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
}
.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: var(--primary-bg); }
.notification-item .title { font-size: 14px; font-weight: 600; }
.notification-item .message { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.notification-item .time { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Live visitors pulse */
.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Period selector */
.period-selector {
    display: inline-flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
}
.period-selector button {
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: white;
    color: var(--gray-600);
    cursor: pointer;
    border-right: 1px solid var(--gray-300);
}
.period-selector button:last-child { border-right: none; }
.period-selector button.active {
    background: var(--primary);
    color: white;
}

/* Visitor timeline */
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.timeline-avatar.anonymous { background: var(--gray-100); color: var(--gray-400); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-name { font-weight: 600; font-size: 14px; }
.timeline-page {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.timeline-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Chart placeholder */
.chart-container {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 14px;
}
/* Simple bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding: 10px 0; }
.bar-chart .bar {
    flex: 1;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    min-width: 8px;
    position: relative;
    transition: background 0.15s;
    cursor: pointer;
}
.bar-chart .bar:hover { background: var(--primary-dark); }
.bar-chart .bar .bar-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 4px;
}
.bar-chart .bar:hover .bar-tooltip { display: block; }

/* Channel bars */
.channel-bars { display: flex; flex-direction: column; gap: 10px; }
.channel-bar-row { display: flex; align-items: center; gap: 12px; }
.channel-bar-label { width: 80px; font-size: 13px; font-weight: 500; color: var(--gray-600); }
.channel-bar-track { flex: 1; height: 24px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.channel-bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; color: white; font-weight: 600; min-width: fit-content; }
.channel-bar-fill.ppc { background: #3B82F6; }
.channel-bar-fill.organic { background: #10B981; }
.channel-bar-fill.social { background: #EC4899; }
.channel-bar-fill.direct { background: #6B7280; }
.channel-bar-fill.email { background: #F59E0B; }
.channel-bar-fill.referral { background: #6366F1; }

/* Setup snippet */
.code-block {
    background: var(--gray-900);
    color: #E5E7EB;
    padding: 16px;
    border-radius: var(--radius);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    position: relative;
}
.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 12px;
    background: rgba(255,255,255,0.1);
    color: var(--gray-300);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,0.2); }

/* Lead detail */
.lead-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.lead-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
}
.lead-info h2 { font-size: 20px; font-weight: 700; }
.lead-info .lead-email { font-size: 14px; color: var(--gray-500); }
.lead-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}
.lead-tabs button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
}
.lead-tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Two column layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* Empty states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { color: var(--gray-600); font-size: 16px; margin-bottom: 4px; }
.empty-state p { font-size: 14px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ========== PUBLIC MARKETING PAGES ========== */

.public-page {
    min-height: 100vh;
}

/* Navbar */
.public-nav {
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}
.public-nav-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    text-decoration: none;
}
.public-nav-logo span { color: var(--primary); }
.public-nav-links { display: flex; gap: 30px; align-items: center; }
.public-nav-links a {
    text-decoration: none;
    color: var(--gray-600);
    font-size: 15px;
    font-weight: 500;
}
.public-nav-links a:hover { color: var(--gray-900); }
.public-nav-links a.btn-primary { color: white; }
.public-nav-links a.btn-primary:hover { color: white; }

/* Hero */
.hero {
    padding: 80px 40px;
    max-width: 1100px;
    margin: 0 auto;
}
.hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}
.hero-content { max-width: 540px; }
.hero-badge {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}
.hero h1 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--gray-900);
    margin-bottom: 20px;
}
.hero h1 em {
    font-style: normal;
    color: var(--primary);
    position: relative;
}
.hero h1 em::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0.3;
    border-radius: 2px;
}
.hero p {
    font-size: 19px;
    color: var(--gray-500);
    line-height: 1.7;
    margin-bottom: 32px;
}
.hero-cta { display: flex; gap: 12px; align-items: center; }

/* Hero dashboard preview */
.hero-visual {
    background: var(--gray-900);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}
.hero-visual::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(194,34,50,0.15) 0%, transparent 70%);
}
.hero-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}
.hero-dash-header h3 { color: white; font-size: 14px; font-weight: 600; }
.hero-dash-header .live-badge {
    background: rgba(93,176,85,0.2);
    color: var(--success);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.hero-dash-header .live-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}
.hero-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
}
.hero-stat {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 14px;
}
.hero-stat .label { font-size: 11px; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-stat .value { font-size: 24px; font-weight: 800; color: white; margin-top: 4px; font-family: 'Montserrat', sans-serif; }
.hero-stat .value.green { color: var(--success); }
.hero-stat .value.primary { color: var(--primary); }
.hero-visitor-feed { display: flex; flex-direction: column; gap: 8px; position: relative; }
.hero-visitor-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.hero-visitor-item .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.hero-visitor-item .info { flex: 1; min-width: 0; }
.hero-visitor-item .vname { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); }
.hero-visitor-item .vdetail { font-size: 11px; color: var(--gray-400); }
.hero-visitor-item .vtime { font-size: 11px; color: var(--gray-500); white-space: nowrap; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.hero-cta .btn-primary {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
}

/* Features */
.features {
    padding: 80px 40px;
    max-width: 1100px;
    margin: 0 auto;
}
.features h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
}
.features .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 18px;
    margin-bottom: 50px;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
.feature-card {
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    background: white;
    transition: box-shadow 0.2s;
}
.feature-card:hover { box-shadow: var(--shadow-lg); }
.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}
.feature-icon.blue { background: #D6EAF8; color: #3086CB; }
.feature-icon.green { background: #E8F5E6; color: #5DB055; }
.feature-icon.purple { background: #E0E7FF; color: #6366F1; }
.feature-icon.pink { background: #CFFAFE; color: #0891B2; }
.feature-icon.yellow { background: #FFF6D9; color: #D4960A; }
.feature-icon.red { background: #CFFAFE; color: #0891B2; }
.feature-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 15px; color: var(--gray-500); line-height: 1.6; }

/* Pricing */
.pricing {
    padding: 80px 40px;
    background: var(--gray-900);
    color: white;
}
.pricing h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
}
.pricing .subtitle {
    text-align: center;
    color: var(--gray-400);
    font-size: 18px;
    margin-bottom: 50px;
}
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}
.pricing-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 32px;
}
.pricing-card.featured {
    background: rgba(194,34,50,0.12);
    border-color: var(--primary);
    position: relative;
}
.pricing-card.featured::before {
    content: 'Most Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 3px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}
.pricing-card h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.pricing-card .price {
    font-size: 42px;
    font-weight: 800;
    margin: 16px 0;
}
.pricing-card .price span { font-size: 16px; font-weight: 500; color: var(--gray-400); }
.pricing-card ul {
    list-style: none;
    margin: 20px 0;
    font-size: 14px;
    color: var(--gray-300);
}
.pricing-card ul li {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pricing-card ul li::before {
    content: '\2713';
    color: var(--success);
    font-weight: 700;
}
.pricing-card .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
}
.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}
.auth-card h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
}
.auth-card .subtitle {
    color: var(--gray-500);
    margin-bottom: 24px;
    font-size: 14px;
}
.auth-card .form-input {
    padding: 10px 14px;
}
.auth-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 15px;
    font-weight: 600;
}
.auth-card .auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--gray-500);
}
.auth-card .auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-error {
    background: var(--danger-bg);
    color: #991B1B;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Footer */
.public-footer {
    padding: 40px;
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
    border-top: 1px solid var(--gray-200);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .hero-inner { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .hero-content { text-align: center; }
    .hero-cta { justify-content: center; }
    .hero h1 { font-size: 32px; }
    .features-grid { grid-template-columns: 1fr; }
    .pricing-cards { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Setup page */
.setup-steps {
    counter-reset: step;
}
.setup-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}
.setup-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.setup-step h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.setup-step p { font-size: 14px; color: var(--gray-500); }

/* Utility */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* VAT disclaimer under pricing */
.price .price-vat { display: block; font-size: 11px; color: #9CA3AF; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }

/* ============ HELP CENTRE ============ */
.help-wrap { max-width: 1200px; }
.help-search { margin-bottom: 20px; }
.help-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
}
.help-search input:focus { outline: none; border-color: var(--primary); }
.help-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}
.help-sidebar {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 8px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.help-cat {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 12px 12px 6px;
    letter-spacing: 0.5px;
}
.help-cat:first-child { padding-top: 6px; }
.help-article-link {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 6px;
    line-height: 1.35;
    transition: background 0.1s;
}
.help-article-link:hover { background: var(--gray-50); }
.help-article-link.active {
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-weight: 600;
}
.help-content {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 32px 36px;
    min-height: 400px;
}
.help-article-cat {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}
.help-article h1 {
    font-size: 26px;
    margin-bottom: 20px;
    color: var(--gray-900);
}
.help-article h3 {
    font-size: 16px;
    margin-top: 22px;
    margin-bottom: 8px;
    color: var(--gray-900);
}
.help-article p {
    font-size: 15px;
    line-height: 1.65;
    color: var(--gray-700);
    margin-bottom: 14px;
}
.help-article ul, .help-article ol {
    padding-left: 22px;
    margin-bottom: 14px;
}
.help-article li {
    font-size: 15px;
    line-height: 1.65;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.help-article a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.help-article a:hover { text-decoration: underline; }
.help-article code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    color: var(--primary-dark);
}
.help-article strong { color: var(--gray-900); }
.help-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-500);
}

@media (max-width: 900px) {
    .help-layout { grid-template-columns: 1fr; }
    .help-sidebar { position: static; max-height: none; }
    .help-content { padding: 20px; }
}

/* ============ CRM Phase 1 ============ */
.crm-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 56px 16px 32px; z-index: 9999;
    overflow-y: auto;
    animation: crmFadeIn 0.15s ease;
}
@keyframes crmFadeIn { from { opacity:0 } to { opacity: 1 } }
@keyframes crmSlideUp { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.crm-modal-panel {
    background: #fff;
    width: 100%; max-width: 560px;
    border-radius: 14px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.25), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    animation: crmSlideUp 0.18s ease;
}
.crm-modal-panel.lg { max-width: 640px; }
.crm-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(180deg, #fafafa, #fff);
}
.crm-modal-header h2 {
    margin: 0; font-size: 17px; font-weight: 600;
    color: var(--gray-900);
}
.crm-modal-header h2 small {
    display: block; font-size: 12px; font-weight: 400;
    color: var(--gray-500); margin-top: 2px;
}
.crm-modal-close {
    background: transparent; border: none;
    color: var(--gray-400); font-size: 22px; line-height: 1;
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: all 0.12s;
}
.crm-modal-close:hover { color: var(--gray-700); background: var(--gray-100); }
.crm-modal-body { padding: 22px 24px; }
.crm-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50, #fafafa);
}

.crm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.crm-form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 540px) { .crm-form-grid, .crm-form-grid.three { grid-template-columns: 1fr; } }

.crm-field { margin-bottom: 14px; }
.crm-field-label {
    display: block;
    font-size: 11px; font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin-bottom: 6px;
}
.crm-field-label .req { color: #C22232; margin-left: 2px; }
.crm-input, .crm-select, .crm-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
    font-size: 14px; font-family: inherit;
    background: #fff;
    color: var(--gray-900);
    transition: border-color 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}
.crm-input:focus, .crm-select:focus, .crm-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}
.crm-textarea { resize: vertical; min-height: 78px; }
.crm-select { appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.crm-error {
    color: #C22232; font-size: 13px;
    margin-top: 10px;
    padding: 8px 12px; border-radius: 6px;
    background: rgba(194, 34, 50, 0.07);
    display: none;
}

/* Toolbar above lists / boards */
.crm-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 18px;
    padding: 12px 16px;
    background: #fff; border: 1px solid var(--gray-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.crm-toolbar .crm-tabs { display: flex; gap: 4px; }
.crm-tab {
    padding: 7px 14px;
    font-size: 13px; font-weight: 500;
    border-radius: 7px;
    color: var(--gray-600); background: transparent;
    border: none; cursor: pointer; text-decoration: none;
    transition: all 0.12s;
}
.crm-tab:hover { background: var(--gray-100); color: var(--gray-900); }
.crm-tab.active {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

/* Kanban */
.kanban-wrap {
    display: flex; gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    /* scrollbar styling */
    scrollbar-width: thin;
}
.kanban-wrap::-webkit-scrollbar { height: 10px; }
.kanban-wrap::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 10px; }

.kanban-col {
    flex: 0 0 280px; width: 280px;
    background: #f8fafc;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 14px 12px;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 220px);
    transition: background 0.15s, border-color 0.15s;
}
.kanban-col.is-over {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}
.kanban-col.is-won { background: #f0fdf4; border-color: #bbf7d0; }
.kanban-col.is-lost { background: #fef2f2; border-color: #fecaca; }
.kanban-col-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding: 0 4px;
}
.kanban-col-title {
    font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--gray-700);
}
.kanban-col-meta {
    font-size: 11px; color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}
.kanban-list { flex: 1; overflow-y: auto; padding: 0 2px; }
.kanban-list::-webkit-scrollbar { width: 6px; }
.kanban-list::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 8px; }

.deal-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.deal-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    border-color: var(--gray-200);
}
.deal-card.dragging { opacity: 0.5; cursor: grabbing; }
.deal-card-title {
    font-weight: 600; font-size: 13px; color: var(--gray-900);
    line-height: 1.35; word-break: break-word;
}
.deal-card-value {
    font-size: 12px; font-weight: 600;
    color: var(--primary-dark);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.deal-card-meta {
    font-size: 11px; color: var(--gray-500);
    margin-top: 4px; display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
}
.deal-card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gray-300); }
.kanban-empty {
    font-size: 12px; color: var(--gray-400);
    text-align: center;
    padding: 18px 8px;
    border: 1px dashed var(--gray-200);
    border-radius: 8px;
    margin-top: 4px;
}

/* CRM section header (above tables) */
.crm-section-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px;
}
.crm-section-head .crm-section-title {
    font-size: 15px; font-weight: 600; color: var(--gray-900);
}
.crm-section-head .crm-section-count {
    font-size: 12px; color: var(--gray-500); font-weight: 400;
    margin-left: 6px;
}

/* Detail page header strip */
.crm-detail-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
    padding: 18px 20px;
    background: #fff; border: 1px solid var(--gray-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.crm-detail-title { font-size: 20px; font-weight: 700; color: var(--gray-900); margin: 0; }
.crm-detail-sub { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.crm-meta-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px; margin-top: 14px;
}
.crm-meta-grid > div { min-width: 0; }
.crm-meta-label {
    font-size: 10px; font-weight: 600; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin-bottom: 4px;
}
.crm-meta-value { font-size: 14px; color: var(--gray-900); word-break: break-word; }
.crm-meta-value a { color: var(--primary-dark); text-decoration: none; font-weight: 500; }
.crm-meta-value a:hover { text-decoration: underline; }

/* ============ Phase 2: Timeline + Activities ============ */
.tl-quickbar {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.tl-quickbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px;
    font-size: 13px; font-weight: 500;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--gray-100);
    color: var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.tl-quickbar-btn:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
    border-color: var(--primary-light);
}

.tl-feed {
    background: #fff; border: 1px solid var(--gray-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    padding: 8px 0;
}
.tl-feed-empty {
    padding: 36px 24px; text-align: center;
    color: var(--gray-400); font-size: 14px;
}

.tl-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    position: relative;
}
.tl-item:last-child { border-bottom: none; }

.tl-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    background: var(--gray-100); color: var(--gray-600);
    flex-shrink: 0;
}
.tl-icon.note { background: #fef3c7; color: #b45309; }
.tl-icon.call { background: #dcfce7; color: #166534; }
.tl-icon.meeting { background: #ede9fe; color: #6d28d9; }
.tl-icon.email { background: #dbeafe; color: #1d4ed8; }
.tl-icon.task { background: var(--primary-bg); color: var(--primary-dark); }
.tl-icon.task.done { background: #dcfce7; color: #166534; }
.tl-icon.visit { background: var(--gray-100); color: var(--gray-500); }
.tl-icon.form { background: #fce7f3; color: #be185d; }

.tl-body { min-width: 0; }
.tl-head {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    margin-bottom: 4px;
}
.tl-title { font-size: 14px; font-weight: 600; color: var(--gray-900); margin: 0; }
.tl-meta { font-size: 11.5px; color: var(--gray-500); }
.tl-meta .sep { margin: 0 6px; color: var(--gray-300); }
.tl-content {
    font-size: 13.5px; color: var(--gray-700);
    line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
    margin-top: 2px;
}
.tl-actions {
    margin-top: 6px;
    display: flex; gap: 8px; align-items: center;
    font-size: 12px;
}
.tl-actions a, .tl-actions button {
    background: transparent; border: none;
    color: var(--gray-500);
    font-size: 12px; cursor: pointer; padding: 0;
}
.tl-actions a:hover, .tl-actions button:hover { color: var(--primary-dark); }
.tl-actions .danger:hover { color: #C22232; }

.tl-task-row {
    display: flex; align-items: flex-start; gap: 10px;
}
.tl-task-check {
    width: 18px; height: 18px;
    border: 2px solid var(--gray-300); border-radius: 6px;
    background: #fff; cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.12s;
}
.tl-task-check.done {
    background: var(--primary); border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='m3 7 3 3 5-6'/%3E%3C/svg%3E");
    background-size: 14px; background-position: center; background-repeat: no-repeat;
}
.tl-task-check:hover:not(.done) { border-color: var(--primary); }

.tl-due {
    font-size: 11.5px; font-weight: 500;
    padding: 2px 8px; border-radius: 10px;
    display: inline-block;
}
.tl-due.overdue { background: #fee2e2; color: #b91c1c; }
.tl-due.today { background: #fef3c7; color: #92400e; }
.tl-due.upcoming { background: var(--gray-100); color: var(--gray-600); }
.tl-due.completed { background: #dcfce7; color: #166534; text-decoration: line-through; }

/* Tasks summary chips on Tasks page */
.task-summary {
    display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.task-chip {
    flex: 1; min-width: 140px;
    padding: 14px 18px;
    background: #fff; border: 1px solid var(--gray-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.task-chip .n { font-size: 22px; font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.task-chip .l { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.task-chip.overdue .n { color: #b91c1c; }
.task-chip.today .n { color: #92400e; }

/* Sidebar badge for open tasks */
.sidebar-nav a .nav-badge {
    background: var(--primary);
    color: #fff;
    font-size: 10.5px; font-weight: 600;
    padding: 1px 7px; border-radius: 10px;
    margin-left: auto;
    min-width: 18px; text-align: center;
    line-height: 16px;
}

/* ============ Pipeline settings ============ */
.pipeline-stages {
    display: flex; flex-direction: column;
    padding: 6px 14px 14px;
}
.pipeline-stage {
    display: grid;
    grid-template-columns: 28px 1fr 130px 70px 70px 36px;
    gap: 14px; align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.12s;
}
.pipeline-stage:hover { background: var(--gray-50, #fafafa); }
.pipeline-stage:last-child { border-bottom: none; }
.pipeline-stage-num {
    width: 24px; height: 24px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: var(--gray-600);
}
.pipeline-stage input.crm-input {
    padding: 7px 10px; font-size: 14px;
}
.pipeline-stage-prob {
    display: flex; align-items: center;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
    padding: 0 8px 0 0;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.pipeline-stage-prob:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}
.pipeline-stage-prob input {
    width: 100%;
    padding: 7px 10px; border: none;
    font-size: 14px; font-family: inherit; background: transparent;
    text-align: right; color: var(--gray-900);
}
.pipeline-stage-prob input:focus { outline: none; }
.pipeline-stage-prob .suffix { font-size: 12px; color: var(--gray-400); padding-left: 2px; }

/* Pretty toggle switch */
.pulse-toggle {
    position: relative; display: inline-block;
    width: 38px; height: 22px;
    cursor: pointer;
}
.pulse-toggle input { opacity: 0; width: 0; height: 0; }
.pulse-toggle-track {
    position: absolute; inset: 0;
    background: var(--gray-200); border-radius: 999px;
    transition: background 0.15s;
}
.pulse-toggle-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: #fff; border-radius: 50%;
    transition: transform 0.18s cubic-bezier(.4,.0,.2,1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.pulse-toggle input:checked + .pulse-toggle-track { background: var(--primary); }
.pulse-toggle input:checked + .pulse-toggle-track + .pulse-toggle-thumb { transform: translateX(16px); }
.pulse-toggle.is-won input:checked + .pulse-toggle-track { background: #16a34a; }
.pulse-toggle.is-lost input:checked + .pulse-toggle-track { background: #dc2626; }

.pipeline-stage-delete {
    background: transparent; border: none;
    color: var(--gray-300);
    font-size: 18px; line-height: 1;
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
}
.pipeline-stage-delete:hover { background: #fee2e2; color: #dc2626; }
.pipeline-head-row {
    display: grid;
    grid-template-columns: 28px 1fr 130px 70px 70px 36px;
    gap: 14px;
    padding: 0 8px 10px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--gray-500);
}
.pipeline-head-row > div:nth-child(4), .pipeline-head-row > div:nth-child(5) { text-align: center; }

/* ============ Form builder ============ */
.fb-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
@media (max-width: 1000px) { .fb-layout { grid-template-columns: 1fr; } }

.fb-card {
    background: #fff; border: 1px solid var(--gray-100);
    border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    overflow: hidden;
}
.fb-card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(180deg, #fafafa, #fff);
}
.fb-card-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.fb-card-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.fb-fields { padding: 8px; }
.fb-field {
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.fb-field.dragging { opacity: 0.45; }
.fb-field.is-over { border-color: var(--primary); border-style: dashed; }
.fb-field-head {
    display: grid;
    grid-template-columns: 22px 1fr auto 30px 30px 30px;
    gap: 12px; align-items: center;
    padding: 12px 16px;
    cursor: pointer;
}
.fb-field-head:hover { background: var(--gray-50, #fafafa); }
.fb-handle {
    color: var(--gray-300);
    cursor: grab; user-select: none;
    text-align: center; font-size: 14px; line-height: 1;
    letter-spacing: 1px;
}
.fb-handle:active { cursor: grabbing; }
.fb-field-label {
    font-size: 14px; font-weight: 500; color: var(--gray-900);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: flex; align-items: center;
}
.fb-field-label .req { color: #dc2626; margin-left: 4px; font-weight: 700; }
.fb-help-tag {
    display: inline-block;
    margin-left: 6px; font-size: 12px;
    color: var(--gray-400); cursor: help;
}
.fb-type-chip {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-bg); color: var(--primary-dark);
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
    white-space: nowrap;
    min-width: 0;
}
.crm-field-hint {
    color: var(--gray-400);
    text-transform: none;
    font-weight: 400;
    margin-left: 6px;
    font-size: 11px;
}
.fb-toggle-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--gray-700);
    cursor: pointer;
}
.fb-toggle-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--primary);
}
.fb-icon-btn {
    background: transparent; border: none;
    width: 28px; height: 28px;
    border-radius: 6px;
    color: var(--gray-400);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    transition: all 0.12s;
}
.fb-icon-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.fb-icon-btn.danger:hover { background: #fee2e2; color: #dc2626; }
.fb-field-edit {
    padding: 14px 16px 18px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50, #fafafa);
}
.fb-empty {
    text-align: center; color: var(--gray-400);
    padding: 30px 20px;
    font-size: 13px;
    border: 1px dashed var(--gray-200);
    border-radius: 10px;
    margin: 6px;
}
.fb-add-row { padding: 10px 12px 12px; }
.fb-add-row .crm-select { width: 200px; display: inline-block; }

.fb-option-row {
    display: grid; grid-template-columns: 1fr 1fr 30px;
    gap: 8px; align-items: center;
    margin-bottom: 6px;
}
.fb-preview-form {
    padding: 18px; background: #fff;
    border: 1px solid var(--gray-100); border-radius: 12px;
}
.fb-preview-form label { display: block; margin-bottom: 12px; font-size: 13px; }
.fb-preview-form label > span { display: block; font-size: 12px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.fb-preview-form .req-mark { color: #dc2626; margin-left: 2px; }
.fb-preview-form input, .fb-preview-form select, .fb-preview-form textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200);
    border-radius: 6px; font-size: 13px; font-family: inherit;
    background: #fff;
}
.fb-preview-form .radio-group { display: flex; gap: 12px; }
.fb-preview-form .radio-group label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.fb-preview-form .submit-btn {
    display: inline-block; padding: 9px 18px;
    background: var(--primary); color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
}

/* Preview tweaks */
.fb-preview-help { font-size: 11px; color: var(--gray-500); margin-top: 4px; }
.fb-preview-desc {
    font-size: 13px; color: var(--gray-600);
    padding: 10px 12px;
    background: var(--gray-50, #fafafa);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    margin-bottom: 14px;
    white-space: pre-wrap;
}
.fb-preview-form.fb-preview-dark {
    background: #0f172a; color: #e2e8f0;
    border-color: #1e293b;
}
.fb-preview-form.fb-preview-dark label > span { color: #94a3b8; }
.fb-preview-form.fb-preview-dark input,
.fb-preview-form.fb-preview-dark select,
.fb-preview-form.fb-preview-dark textarea {
    background: #1e293b; border-color: #334155; color: #e2e8f0;
}
.fb-preview-form.fb-preview-dark .fb-preview-help { color: #64748b; }
.fb-preview-form.fb-preview-dark .fb-preview-desc { background: #1e293b; color: #cbd5e1; }

/* ============ Form builder: Look & feel panel ============ */
.fb-color-row {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    gap: 8px;
    align-items: center;
}
.fb-color-row input[type="color"] {
    width: 38px; height: 38px;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}
.fb-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.fb-color-row input[type="color"]::-webkit-color-swatch { border-radius: 5px; border: none; }
.fb-color-clear {
    background: transparent; border: 1px solid var(--gray-200);
    color: var(--gray-400);
    width: 28px; height: 28px;
    border-radius: 6px; cursor: pointer;
    font-size: 14px; line-height: 1;
    transition: all 0.12s;
}
.fb-color-clear:hover { background: var(--gray-100); color: var(--gray-700); }

.fb-section-divider {
    font-size: 10.5px; font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.6px;
    padding: 14px 0 8px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 14px;
}

.fb-presets {
    display: flex; gap: 8px;
    flex-wrap: wrap;
}
.fb-preset {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 999px;
    color: #fff;
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.12s, box-shadow 0.12s;
}
.fb-preset:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }
.fb-preset span { color: inherit; }

/* Sticky live preview on form builder */
.fb-preview-sticky {
    position: sticky;
    top: 78px;
    align-self: flex-start;
}
@media (max-width: 1000px) {
    .fb-preview-sticky { position: static; }
}
