/* ============================================================
   Marketing AI — Dark Mode Dashboard Stylesheet
   ============================================================ */

/* -------------------------------------------------------
   1. CSS Custom Properties
   ------------------------------------------------------- */

:root {
    --bg-base: #0f1117;
    --bg-surface: #1a1d27;
    --bg-raised: #22252f;
    --border: #2d3040;
    --border-hover: #3d4060;

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-faint: rgba(99, 102, 241, 0.12);
    --primary-glow: rgba(99, 102, 241, 0.25);

    --success: #10b981;
    --success-faint: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-faint: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-faint: rgba(245, 158, 11, 0.12);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --sidebar-width: 240px;
    --topbar-height: 56px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    --font-sans:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    --font-mono:
        "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

/* -------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------- */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    display: block;
}

::selection {
    background: var(--primary-glow);
    color: #fff;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* -------------------------------------------------------
   3. Sidebar
   ------------------------------------------------------- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-header .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-header .logo-accent {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    list-style: none;
}

.nav-item {
    display: block;
}

.nav-item a,
.nav-item button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.nav-item a:hover,
.nav-item button:hover {
    color: var(--text-primary);
    background: var(--primary-faint);
}

.nav-item.active a,
.nav-item.active button {
    color: var(--primary-hover);
    background: var(--primary-faint);
    border-right: 3px solid var(--primary);
}

.nav-item .nav-icon {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* -------------------------------------------------------
   4. Main Wrapper & Topbar
   ------------------------------------------------------- */

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 150;
    height: var(--topbar-height);
    background: rgba(26, 29, 39, 0.85);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.menu-toggle:hover {
    color: var(--text-primary);
    background: var(--primary-faint);
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.job-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
}

/* -------------------------------------------------------
   5. Job Banner & Progress
   ------------------------------------------------------- */

.job-banner {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    padding: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition:
        max-height var(--transition-slow),
        opacity var(--transition-slow),
        padding var(--transition-slow);
}

.job-banner.visible {
    max-height: 80px;
    opacity: 1;
    padding: 0.75rem 1.5rem;
}

.job-banner .banner-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.progress-fill.indeterminate {
    width: 30% !important;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(250%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* -------------------------------------------------------
   6. Content Area
   ------------------------------------------------------- */

.content {
    flex: 1;
    padding: 1.75rem 2rem;
    max-width: 1400px;
    width: 100%;
}

/* -------------------------------------------------------
   7. Cards
   ------------------------------------------------------- */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2,
.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

/* -------------------------------------------------------
   8. Buttons
   ------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-raised);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #0ea572;
    border-color: #0ea572;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: #1a1d27;
    border-color: var(--warning);
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    border-color: #d97706;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--primary-faint);
    color: var(--primary-hover);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-danger-ghost:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: transparent;
}

.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* -------------------------------------------------------
   9. Forms
   ------------------------------------------------------- */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.5625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-faint);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

select.form-control {
    cursor: pointer;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* -------------------------------------------------------
   10. Tables
   ------------------------------------------------------- */

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-raised);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--primary-faint);
}

.table td {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* -------------------------------------------------------
   11. Page Header
   ------------------------------------------------------- */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.page-header .stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.page-header .stat-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

/* -------------------------------------------------------
   12. Lead Filters
   ------------------------------------------------------- */

.lead-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
    position: relative;
}

.tab:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--border);
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab.active {
    color: var(--primary-hover);
    background: var(--primary-faint);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    margin-left: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--primary-faint);
    color: var(--primary-hover);
    vertical-align: middle;
}

.tab-trash {
    color: var(--text-muted);
    opacity: 0.7;
}

.tab-trash:hover {
    color: var(--danger);
    opacity: 1;
}

.tab-trash.active {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    opacity: 1;
}

.tab-trash .tab-count {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.stat-trashed {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.lead-filters .form-control {
    max-width: 220px;
}

/* -------------------------------------------------------
   13. Leads Grid & Lead Cards
   ------------------------------------------------------- */

.leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1rem;
}

.lead-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition:
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.lead-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.lead-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.lead-handle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-hover);
    text-decoration: none;
}

.lead-handle:hover {
    color: var(--primary);
    text-decoration: underline;
}

.lead-score {
    flex-shrink: 0;
}

.lead-bio {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lead-draft-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    margin-bottom: 1rem;
}

.lead-draft-section label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.lead-draft-section textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    line-height: 1.55;
    resize: vertical;
    min-height: 56px;
}

.lead-draft-section textarea:focus {
    outline: none;
}

.lead-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* -------------------------------------------------------
   14. Score Badges
   ------------------------------------------------------- */

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.8125rem;
    color: #fff;
    flex-shrink: 0;
}

.score-high {
    background: var(--success);
}

.score-medium {
    background: var(--warning);
    color: #1a1d27;
}

.score-low {
    background: var(--danger);
}

/* -------------------------------------------------------
   15. Status Pills
   ------------------------------------------------------- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-full);
    background: var(--bg-raised);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-new {
    color: var(--primary-hover);
    border-color: rgba(99, 102, 241, 0.25);
    background: var(--primary-faint);
}

.status-new::before {
    background: var(--primary);
}

.status-sent {
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.25);
    background: var(--success-faint);
}

.status-sent::before {
    background: var(--success);
}

.status-ignored {
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--bg-raised);
}

.status-ignored::before {
    background: var(--text-muted);
}

/* -------------------------------------------------------
   16. Badges (General)
   ------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
}

.badge-primary {
    background: var(--primary-faint);
    color: var(--primary-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

.badge-success {
    background: var(--success-faint);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: var(--danger-faint);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: var(--warning-faint);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-neutral {
    background: var(--bg-raised);
    color: var(--text-muted);
    border-color: var(--border);
}

/* -------------------------------------------------------
   17. Creative Section
   ------------------------------------------------------- */

.creative-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.creative-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.generate-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.generate-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.generate-form .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* -------------------------------------------------------
   18. Post Preview Card
   ------------------------------------------------------- */

.post-preview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.post-preview-card:hover {
    border-color: var(--border-hover);
}

.post-preview-card img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.post-preview-card .captions-area {
    padding: 1.25rem;
}

.caption-option {
    background: var(--bg-raised);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        background var(--transition-fast);
}

.caption-option:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.04);
}

.caption-option.selected {
    border-color: var(--primary);
    background: var(--primary-faint);
}

.caption-option label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.caption-option input[type="radio"] {
    margin-top: 0.25rem;
    accent-color: var(--primary);
}

.caption-option .caption-text {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.caption-option.selected .caption-text {
    color: var(--text-primary);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

/* -------------------------------------------------------
   19. Empty State
   ------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* -------------------------------------------------------
   20. Toast Notifications
   ------------------------------------------------------- */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    animation: toast-slide-in 0.3s ease forwards;
    max-width: 400px;
}

.toast.removing {
    animation: toast-slide-out 0.25s ease forwards;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast .toast-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
}

.toast .toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast .toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    font-family: inherit;
    transition: color var(--transition-fast);
}

.toast .toast-close:hover {
    color: var(--text-primary);
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* -------------------------------------------------------
   21. Spinners & Pulse Dot
   ------------------------------------------------------- */

.spinner-small {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.pulse-dot::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--success);
    opacity: 0.4;
    animation: pulse-ring 1.8s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* -------------------------------------------------------
   22. Alerts
   ------------------------------------------------------- */

.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-faint);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.alert-error {
    background: var(--danger-faint);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-faint);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.alert-info {
    background: var(--primary-faint);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--primary-hover);
}

/* -------------------------------------------------------
   23. Loading State
   ------------------------------------------------------- */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* -------------------------------------------------------
   24. Text Utilities
   ------------------------------------------------------- */

.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.text-muted {
    color: var(--text-muted);
}
.text-secondary {
    color: var(--text-secondary);
}
.text-sm {
    font-size: 0.8125rem;
}
.text-xs {
    font-size: 0.6875rem;
}

.text-primary-accent {
    color: var(--primary);
}
.text-success {
    color: var(--success);
}
.text-danger {
    color: var(--danger);
}
.text-warning {
    color: var(--warning);
}

.font-medium {
    font-weight: 500;
}
.font-semibold {
    font-weight: 600;
}
.font-bold {
    font-weight: 700;
}
.font-mono {
    font-family: var(--font-mono);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -------------------------------------------------------
   25. Spacing Utilities
   ------------------------------------------------------- */

.mt-0 {
    margin-top: 0;
}
.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-3 {
    margin-top: 0.75rem;
}
.mt-4 {
    margin-top: 1rem;
}
.mt-5 {
    margin-top: 1.5rem;
}
.mt-6 {
    margin-top: 2rem;
}

.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 0.25rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mb-3 {
    margin-bottom: 0.75rem;
}
.mb-4 {
    margin-bottom: 1rem;
}
.mb-5 {
    margin-bottom: 1.5rem;
}
.mb-6 {
    margin-bottom: 2rem;
}

.ml-auto {
    margin-left: auto;
}
.mr-auto {
    margin-right: auto;
}

.p-0 {
    padding: 0;
}
.p-1 {
    padding: 0.25rem;
}
.p-2 {
    padding: 0.5rem;
}
.p-3 {
    padding: 0.75rem;
}
.p-4 {
    padding: 1rem;
}
.p-5 {
    padding: 1.5rem;
}
.p-6 {
    padding: 2rem;
}

/* -------------------------------------------------------
   26. Flex & Layout Utilities
   ------------------------------------------------------- */

.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.flex-wrap {
    flex-wrap: wrap;
}
.flex-1 {
    flex: 1;
}
.flex-shrink-0 {
    flex-shrink: 0;
}

.items-center {
    align-items: center;
}
.items-start {
    align-items: flex-start;
}
.items-end {
    align-items: flex-end;
}

.justify-center {
    justify-content: center;
}
.justify-between {
    justify-content: space-between;
}
.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: 0.25rem;
}
.gap-2 {
    gap: 0.5rem;
}
.gap-3 {
    gap: 0.75rem;
}
.gap-4 {
    gap: 1rem;
}
.gap-5 {
    gap: 1.5rem;
}
.gap-6 {
    gap: 2rem;
}

.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.w-full {
    width: 100%;
}
.h-full {
    height: 100%;
}

/* -------------------------------------------------------
   27. Visibility & Misc Utilities
   ------------------------------------------------------- */

.hidden {
    display: none;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.separator {
    height: 1px;
    background: var(--border);
    border: none;
    margin: 1rem 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* -------------------------------------------------------
   28. Responsive
   ------------------------------------------------------- */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .content {
        padding: 1.25rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .lead-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .lead-filters .form-control {
        max-width: 100%;
    }

    .leads-grid {
        grid-template-columns: 1fr;
    }

    .lead-actions {
        flex-direction: column;
    }

    .lead-actions .btn {
        width: 100%;
    }

    .generate-form .form-row {
        flex-direction: column;
    }

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        font-size: 0.875rem;
    }

    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .filter-tabs {
        width: 100%;
    }

    .tab {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .btn-lg {
        width: 100%;
    }
}
