/* ================================================================
   VoiceAgent SaaS — Custom Stylesheet
   Font: Inter (Google Fonts)
================================================================ */

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
    color-scheme: dark;
    --bg-deep:      #0b0f1a;
    --bg-card:      #111827;
    --bg-card-2:    #1a2234;
    --accent:       #7c3aed;
    --accent-light: #a78bfa;
    --accent-glow:  rgba(124, 58, 237, 0.3);
    --success:      #10b981;
    --danger:       #ef4444;
    --warning:      #f59e0b;
    --info:         #3b82f6;
    --text-primary: #f1f5f9;
    --text-muted:   #64748b;
    --border:       rgba(255,255,255,0.08);
    --radius:       0.75rem;
    --radius-sm:    0.5rem;
    --shadow-lg:    0 20px 60px rgba(0,0,0,0.4);
    --transition:   all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9375rem;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.65;
}

body.app-hide-convai elevenlabs-convai,
body.app-hide-convai .convai-widget,
body.app-hide-convai [class*="convai"],
body.app-hide-convai [id*="convai"],
body.app-hide-convai iframe[src*="convai"] {
    display: none !important;
}

/* ── Typography Helpers ────────────────────────────────────────── */
.fw-800 { font-weight: 800 !important; }
.fw-700 { font-weight: 700 !important; }
.text-accent { color: var(--accent-light) !important; }

/* ── Navbar ────────────────────────────────────────────────────── */
.va-navbar {
    background: rgba(11, 15, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.va-navbar .brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 0 12px var(--accent-glow);
}

.va-navbar .nav-link {
    color: #94a3b8 !important;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.va-navbar .nav-link:hover,
.va-navbar .nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(255,255,255,0.06);
}

/* ── App layout: sidebar + main (authenticated) ───────────────── */
body.va-app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.va-sidebar-open {
    overflow: hidden;
}

@media (min-width: 992px) {
    body.va-sidebar-open {
        overflow: auto;
    }
}

.va-app-shell {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

.va-sidebar {
    width: 268px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0f1419 0%, var(--bg-card) 45%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1045;
}

.va-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    padding: 1.25rem 0.75rem 1rem;
}

.va-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.05rem;
    padding: 0.35rem 0.5rem 1.25rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.va-sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 0 14px var(--accent-glow);
    flex-shrink: 0;
}

.va-sidebar-brand-text {
    letter-spacing: -0.02em;
}

.va-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.25rem 0;
    flex: 1;
}

.va-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}

.va-sidebar-link i {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
    opacity: 0.9;
}

.va-sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.06);
}

.va-sidebar-link.is-active {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.18);
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.12);
}

.va-sidebar-link.is-active i {
    color: var(--accent-light);
}

.va-sidebar-user {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.va-sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    transition: var(--transition);
}

.va-sidebar-user-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(124, 58, 237, 0.35);
}

.va-sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    text-align: left;
}

.va-sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.va-sidebar-user-email {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.va-sidebar-user-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.va-sidebar-dropdown {
    margin-bottom: 0.35rem;
}

.va-main-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-deep);
}

.va-mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 15, 26, 0.92);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.va-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transition: var(--transition);
}

.va-sidebar-toggle:hover {
    background: rgba(124, 58, 237, 0.25);
    color: #fff;
}

.va-mobile-topbar-title {
    flex: 1;
    text-align: center;
    font-size: 1rem;
}

.va-mobile-topbar-spacer {
    width: 2.5rem;
    flex-shrink: 0;
}

.va-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.va-sidebar-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 991.98px) {
    .va-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        max-width: min(288px, 88vw);
        box-shadow: 16px 0 48px rgba(0, 0, 0, 0.55);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .va-sidebar.is-open {
        transform: translateX(0);
    }
}

@media (min-width: 992px) {
    .va-sidebar-backdrop {
        display: none !important;
    }

    .va-sidebar {
        position: relative;
        transform: none !important;
    }
}

.va-footer-app {
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── Telephony: number row → agent modal ───────────────────────── */
.va-number-map-trigger {
    transition: var(--transition);
    cursor: pointer;
}

.va-number-map-trigger:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06) !important;
}

.va-number-map-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.va-number-map-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.va-mapping-table-wrap {
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.65) 0%, rgba(11, 15, 26, 0.9) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.va-mapping-table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(124, 58, 237, 0.07);
}

.va-mapping-table thead th {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.9rem 1.15rem;
    background: rgba(0, 0, 0, 0.45);
    vertical-align: middle;
}

.va-mapping-table tbody td {
    border-color: rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.va-mapping-table tbody td:nth-child(2),
.va-mapping-table tbody td:nth-child(3) {
    padding: 1rem 1.15rem !important;
    font-size: 0.875rem;
    color: #cbd5e1 !important;
}

.va-mapping-table tbody td:nth-child(4) {
    padding: 0.85rem 1rem !important;
}

.va-mapping-table tbody tr {
    transition: background 0.18s ease;
}

.va-mapping-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.06) !important;
}

.va-mapping-table tbody tr:last-child td {
    border-bottom-color: transparent;
}

.va-number-map-trigger .va-num-display {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.va-modal-dark {
    background: linear-gradient(165deg, #151c2c 0%, #111827 55%, #0f1419 100%);
    color: var(--text-primary);
    border-radius: var(--radius) !important;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(124, 58, 237, 0.12);
}

.va-modal-dark .modal-header,
.va-modal-dark .modal-footer {
    background: rgba(0, 0, 0, 0.28);
}

.va-modal-dark .modal-body {
    padding-top: 1.35rem;
}

.va-modal-dark .form-select {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: var(--text-primary) !important;
    color-scheme: dark;
}

.va-modal-dark .form-select:focus {
    background-color: #243047 !important;
}

.va-modal-dark .form-text {
    color: #64748b;
    font-size: 0.8rem;
}

.va-modal-dark .form-check-input {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.va-modal-dark .form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ── Avatar circle ─────────────────────────────────────────────── */
.avatar-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ── Dropdown ──────────────────────────────────────────────────── */
.va-dropdown {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
}

.va-dropdown .dropdown-item {
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.va-dropdown .dropdown-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

/* ── Accent Button ─────────────────────────────────────────────── */
.btn-accent {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    color: #fff !important;
    border: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.va-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: var(--transition);
}

.va-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.va-card-flat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
}

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.purple  { background: rgba(124,58,237,0.15); color: var(--accent-light); }
.stat-icon.green   { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-icon.blue    { background: rgba(59,130,246,0.15); color: var(--info); }
.stat-icon.orange  { background: rgba(245,158,11,0.15); color: var(--warning); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control {
    background-color: rgba(255,255,255,0.04) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.6rem 0.9rem;
    transition: var(--transition);
}

/* Native <select>: dark surface + options (Windows/Chrome shows white otherwise) */
.form-select {
    background-color: var(--bg-card-2) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.6rem 2.75rem 0.6rem 0.9rem;
    transition: var(--transition);
    color-scheme: dark;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a78bfa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.85rem center !important;
    background-size: 14px 10px !important;
}

.form-select:focus {
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    border-color: var(--accent) !important;
    background-color: rgba(26, 34, 52, 0.95) !important;
}

.form-control:focus {
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    border-color: var(--accent) !important;
    background-color: rgba(255,255,255,0.06) !important;
}

select.form-select option,
.form-select option {
    background-color: #1e293b;
    color: var(--text-primary);
    padding: 0.5rem;
}

.form-control::placeholder { color: var(--text-muted) !important; }

.form-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.input-group-text {
    background: rgba(255,255,255,0.04) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}

/* ── Wizard UI ─────────────────────────────────────────────────── */
.wizard {
    margin-top: 1rem;
}

.wizard-shell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .wizard-shell { padding: 1.5rem; }
}

.wizard-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.wizard-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    transition: var(--transition);
}

.wizard-dot.is-active {
    width: 20px;
    background: var(--accent-light);
    box-shadow: 0 0 10px var(--accent-glow);
}

.wizard-step {
    display: none !important;
}

.wizard-step.is-active {
    display: block !important;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.75rem;
}

.wizard-actions .btn {
    min-width: 120px;
}

/* ── Agent tabs ─────────────────────────────────────────────── */
.agent-tabs {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.agent-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    transition: var(--transition);
}

.agent-tab.is-active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 8px 22px rgba(0,0,0,0.25);
}

.agent-tab-panel {
    display: none;
}

.agent-tab-panel.is-active {
    display: block;
}

/* ── Widget settings ───────────────────────────────────────── */
.widget-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.widget-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.widget-section-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.widget-section-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.widget-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1rem 1.1rem;
}

.widget-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.8rem 1.2rem;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.switch-row .form-check-input {
    margin: 0;
}

/* ── Widget live preview ───────────────────────────────────── */
.widget-preview {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9990;
}

.widget-preview-card {
    background: rgba(8, 10, 15, 0.9);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    backdrop-filter: blur(12px);
}

.widget-preview-label {
    font-size: 0.8rem;
    color: #e5e7eb;
    padding: 0 0.35rem;
    white-space: nowrap;
}

.widget-preview-actions {
    display: inline-flex;
    gap: 0.35rem;
}

.widget-preview-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: #ffffff;
    color: #111827;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.widget-preview-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .widget-preview { right: 12px; bottom: 12px; }
    .widget-preview-label { display: none; }
}

.wizard-actions .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.select-card {
    width: 100%;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.select-card * {
    pointer-events: none;
}

.select-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    transform: translateY(-1px);
}

.select-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: linear-gradient(180deg, rgba(124,58,237,0.08), rgba(124,58,237,0.02));
}

.select-card-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.select-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Auth pages ─────────────────────────────────────────────────── */
.auth-wrapper {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 20px var(--accent-glow);
    margin: 0 auto 1.25rem;
}

/* ── Hero section ───────────────────────────────────────────────── */
.va-hero {
    padding: 6rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.va-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,58,237,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
    color: var(--accent-light);
    padding: 0.3rem 0.9rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-light), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 1.125rem;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 560px;
}

/* ── Feature cards (landing) ────────────────────────────────────── */
.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(124,58,237,0.12);
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--accent-light);
    margin-bottom: 1rem;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.va-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,0.02);
    --bs-table-border-color: var(--border);
    color: var(--text-primary) !important;
}

.va-table thead th {
    background: rgba(255,255,255,0.03);
    border-color: var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0.85rem 1rem;
}

.va-table tbody td {
    padding: 0.85rem 1rem;
    border-color: var(--border);
    vertical-align: middle;
    font-size: 0.875rem;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge-tool {
    background: rgba(124,58,237,0.12);
    color: var(--accent-light);
    border: 1px solid rgba(124,58,237,0.22);
    padding: 0.3em 0.75em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Toggle switch ──────────────────────────────────────────────── */
.tool-toggle-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.6rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.tool-toggle-card:hover {
    border-color: rgba(124,58,237,0.35);
    transform: translateY(-1px);
}

.tool-toggle-card .tool-info {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.tool-toggle-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tool-card-title {
    font-weight: 700;
    font-size: 1rem;
}

.tool-card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

/* ── Tools page layout ─────────────────────────────────────── */
.tools-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2rem;
    align-items: start;
}

.tools-main {
    min-width: 0;
}

.tools-side {
    position: sticky;
    top: 90px;
}

.tools-tabs {
    display: inline-flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    padding: 0.3rem;
    border-radius: 999px;
}

.tools-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
}

.tools-tab.is-active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tools-mcp {
    display: none;
}

.tools-search {
    position: relative;
}

.tools-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.tools-search .form-control {
    padding-left: 2.25rem;
}

.tools-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tools-empty {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.tools-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
}

.system-tools {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
}

.system-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.system-tools-header h6 {
    margin: 0 0 0.25rem;
    font-weight: 700;
}

.system-tools-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.system-tools-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.system-tool-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.9rem;
}

@media (max-width: 992px) {
    .tools-layout { grid-template-columns: 1fr; }
    .tools-side { position: static; }
}

/* ── Workflow layout ────────────────────────────────────────── */
.workflow-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2rem;
    align-items: start;
}

.workflow-canvas {
    background: #0c111b;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    min-height: 520px;
    position: relative;
    overflow: hidden;
}

.workflow-toolbar {
    display: inline-flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.04);
    padding: 0.4rem;
    border-radius: 0.9rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.workflow-grid {
    position: relative;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 18px 18px;
    border-radius: 0.9rem;
    padding: 2rem;
    min-height: 380px;
}

.workflow-node {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 0.7rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.workflow-node.start {
    background: rgba(255,255,255,0.06);
    font-weight: 700;
}

.workflow-line {
    width: 2px;
    height: 40px;
    background: rgba(255,255,255,0.12);
    margin: 0.75rem 0 0.75rem 1.25rem;
}

.workflow-branches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1.2rem;
}

.workflow-branch {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.workflow-chip {
    align-self: flex-start;
    background: rgba(124,58,237,0.18);
    color: var(--accent-light);
    border: 1px solid rgba(124,58,237,0.35);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.workflow-side {
    position: sticky;
    top: 90px;
}

.workflow-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
}

.workflow-card h6 {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

@media (max-width: 992px) {
    .workflow-layout { grid-template-columns: 1fr; }
    .workflow-side { position: static; }
}

/* ── Branches page ─────────────────────────────────────────── */
.branches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.branches-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.branches-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.branches-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
}

.branches-row {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr 2fr 48px;
    padding: 0.9rem 1.1rem;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    font-size: 0.9rem;
}

.branches-row:last-child {
    border-bottom: none;
}

.branches-head {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
}

.branches-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 992px) {
    .branches-row { grid-template-columns: 1.5fr 1fr 1.5fr 1.5fr 40px; }
}

@media (max-width: 768px) {
    .branches-row { grid-template-columns: 1fr; gap: 0.4rem; }
    .branches-row > button { justify-self: start; }
}

/* ── Knowledge base ─────────────────────────────────────────── */
.kb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kb-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.kb-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kb-search {
    position: relative;
}

.kb-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.kb-search .form-control {
    padding-left: 2.25rem;
}

.kb-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kb-upload {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.kb-file-input {
    color: var(--text-muted);
    max-width: 320px;
}

.kb-empty {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    text-align: center;
}

.kb-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
}

.kb-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
}

.kb-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 0.85rem 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    font-size: 0.9rem;
}

.kb-row:last-child {
    border-bottom: none;
}

.kb-head {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
}

@media (max-width: 768px) {
    .kb-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .kb-upload { flex-direction: column; align-items: flex-start; }
}

/* ── Security ────────────────────────────────────────────────── */
.security-header h2 {
    margin: 0 0 1.5rem;
    font-size: 1.6rem;
    font-weight: 700;
}

.security-section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.security-section:last-child {
    border-bottom: none;
}

.security-row {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr;
    gap: 2rem;
    align-items: start;
}

.security-meta h6 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.security-meta p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.security-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.security-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.security-learn {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.security-learn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    flex-shrink: 0;
}

.security-learn strong {
    display: block;
    font-size: 0.9rem;
}

.security-learn span {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.security-warning {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

.security-warning strong {
    display: block;
    font-size: 0.9rem;
}

.security-warning span {
    display: block;
    font-size: 0.8rem;
    color: #fca5a5;
}

.security-list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
}

.security-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.security-list-row:last-child {
    border-bottom: none;
}

.security-list-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.security-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
}

.security-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255,255,255,0.02);
}

.security-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.security-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.security-input-suffix {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    margin-left: 0.4rem;
    color: #fde68a;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

@media (max-width: 900px) {
    .security-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .security-toggles { grid-template-columns: 1fr; }
    .security-input-row { flex-direction: column; align-items: flex-start; }
}

.tools-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tools-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.tools-subtitle {
    color: var(--text-muted);
    margin: 0;
}

/* Custom toggle switch */
.form-check-input[type="checkbox"] {
    width: 2.8em;
    height: 1.5em;
    cursor: pointer;
    background-color: #374151;
    border-color: #4b5563;
}

.form-check-input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Webhook URL box ────────────────────────────────────────────── */
.webhook-box {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--success);
    word-break: break-all;
}

/* ── Page headers ───────────────────────────────────────────────── */
.page-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* ── Payload viewer ─────────────────────────────────────────────── */
.payload-pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: 0.75rem;
    color: #86efac;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.va-footer {
    background: rgba(11,15,26,0.8);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── Utility ─────────────────────────────────────────────────────── */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    color: #374151;
}

/* Glow pulse animation */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
    50%       { box-shadow: 0 0 25px rgba(124,58,237,0.5); }
}

.glow-pulse { animation: glow-pulse 2.5s ease-in-out infinite; }

/* Fade-in animation on load */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.5s ease forwards; }

/* ── Responsive tweaks ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .auth-card { padding: 1.75rem; }
    .hero-title { font-size: 2rem; }
    .stat-card  { flex-direction: column; align-items: flex-start; }
}
