:root {
    color-scheme: light;

    --bg: #F7F7F5;
    --bg-soft: #F3F4F6;
    --bg-strong: #EEEEEA;
    --panel: #FFFFFF;
    --panel-alt: #F9FAFB;
    --border: #E5E5E5;
    --text: #171717;
    --muted: #6B7280;
    --muted-soft: #9CA3AF;
    --accent: #2563EB;
    --accent-2: #6D5CE7;
    --success: #16A34A;
    --warning: #D97706;
    --error: #DC2626;
    --shadow: 0 12px 28px rgba(17, 24, 39, 0.04);
    --shadow-soft: 0 8px 22px rgba(17, 24, 39, 0.03);
}


/* ============================================================
   GLOBAL
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body.nav-locked {
    overflow: hidden;
}

body.embed-mode {
    background: var(--bg);
}

body.embed-mode .topbar {
    display: none;
}

body.embed-mode .page {
    padding: 0;
    margin: 0;
    max-width: none;
}

body.embed-mode .hero {
    display: block;
    padding: 0;
}

body.embed-mode .preview-panel {
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

body.embed-mode .preview-body {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
}

::selection {
    background: rgba(37, 99, 235, 0.12);
    color: var(--text);
}


/* ============================================================
   BACKGROUND
   ============================================================ */

.background-orb {
    display: none;
}


/* ============================================================
   LINKS
   ============================================================ */

a {
    color: var(--accent);
    text-decoration: none;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

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


/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;

    background: rgba(255, 255, 255, 0.94);

    border-bottom: 1px solid var(--border);

    backdrop-filter: none;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 1rem;

    max-width: 1280px;
    margin: 0 auto;

    padding: 1rem 1.5rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.topbar-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.desktop-actions {
    display: flex;
}

.brand {
    display: inline-flex;
    align-items: center;

    gap: 0.75rem;

    font-weight: 700;
    font-size: 1rem;

    color: var(--text);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border-radius: 10px;

    background: #171717;
    color: #fff;

    box-shadow: none;
}

.brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 10px;
}

.nav-link-small {
    color: var(--muted);

    font-size: 0.86rem;

    text-transform: none;
    letter-spacing: 0;

    opacity: 1;

    font-weight: 500;
}

.nav-link-small:hover {
    color: var(--text);
}

.nav-pill {
    padding: 0.7rem 1rem;

    text-transform: none;
    letter-spacing: 0;

    font-size: 0.82rem;
}

.topbar-actions .button {
    padding: 0.72rem 1rem;

    min-width: 110px;

    font-size: 0.9rem;
}

.topbar-actions .button-secondary {
    background: #fff;
    color: var(--text);
    border-color: #DCDCDC;
}

.topbar-actions .button-secondary:hover {
    background: #F7F7F7;
    color: var(--text);
}


/* ============================================================
   USER AVATAR
   ============================================================ */

.user-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    border-radius: 50%;

    background: #171717;
    color: #fff;

    font-weight: 700;

    margin-left: 8px;

    font-size: 0.95rem;
    line-height: 1;

    vertical-align: middle;
}


/* ============================================================
   MOBILE NAV
   ============================================================ */

.topbar-burger {
    display: none;

    width: 42px;
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: #fff;
    color: var(--text);

    cursor: pointer;

    align-items: center;
    justify-content: center;

    padding: 0.4rem;
}

.burger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 1.2rem;
    line-height: 1;
}

.topbar-collapse {
    display: none;

    align-items: center;

    gap: 0.75rem;
}

.topbar.nav-open .topbar-collapse {
    display: flex;
}


/* ============================================================
   PAGE / HERO
   ============================================================ */

.page {
    max-width: 1280px;

    margin: 0 auto;

    padding: 2rem 1.5rem 4rem;
}

.hero {
    display: grid;

    grid-template-columns: 1.05fr 0.95fr;

    gap: 2rem;

    align-items: center;

    padding: 2.5rem 0 1.5rem;
}

.hero-copy-block {
    max-width: 700px;
}

.hero h1 {
    font-size: clamp(2.6rem, 3.6vw, 4rem);

    line-height: 1.08;

    margin: 0 0 1rem;

    letter-spacing: -0.05em;
}

.hero-copy {
    font-size: 1.04rem;

    line-height: 1.7;

    color: var(--muted);

    max-width: 42rem;
}

.eyebrow {
    text-transform: uppercase;

    letter-spacing: 0.14em;

    color: var(--muted);

    font-size: 0.72rem;

    margin-bottom: 0.8rem;

    font-weight: 700;
}

.hero-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 0.9rem;

    margin-top: 1.7rem;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 0.85rem 1.2rem;

    border-radius: 10px;

    background: #171717;
    color: #fff;

    font-weight: 600;

    border: 1px solid #171717;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);

    box-shadow: none;

    color: #fff;
}

.button-secondary {
    background: #fff;

    color: var(--text);

    border: 1px solid #DCDCDC;
}

.button-secondary:hover {
    background: #F7F7F7;

    color: var(--text);

    border-color: #D0D0D0;
}

.button.disabled {
    opacity: 0.6;

    pointer-events: none;
}


/* ============================================================
   TRUST
   ============================================================ */

.trust-row {
    display: flex;

    flex-wrap: wrap;

    gap: 0.7rem;

    margin-top: 1.4rem;
}

.trust-chip {
    padding: 0.45rem 0.75rem;

    border-radius: 999px;

    border: 1px solid var(--border);

    color: var(--muted);

    font-size: 0.83rem;

    background: #fff;
}


/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--panel);

    border: 1px solid var(--border);

    border-radius: 16px;

    padding: 1.35rem;

    box-shadow: var(--shadow-soft);

    backdrop-filter: none;
}


/* ============================================================
   PLAN
   ============================================================ */

.plan-card {
    display: flex;

    flex-direction: column;

    min-height: 100%;
}

.plan-feature-list {
    list-style: none;

    padding: 0;

    margin: 1rem 0 1.25rem;

    display: grid;

    gap: 0.55rem;

    flex: 1;
}

.plan-feature-list li {
    display: flex;

    align-items: center;

    gap: 0.6rem;

    font-size: 0.95rem;

    color: var(--muted);

    min-height: 1.35rem;
}

.plan-feature-list li.included {
    color: #dcfce7;
}

.plan-feature-list li.not-included {
    color: #fecaca;
}

.feature-status {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 1.1rem;

    flex-shrink: 0;

    font-weight: 700;
}

.plan-actions {
    margin-top: auto;
}

.plan-summary {
    margin-bottom: 1.25rem;
}


/* ============================================================
   AI MESSAGE USAGE
   ============================================================ */

.ai-message-usage {
    margin-top: 1.5rem;
}

.ai-message-usage-header {
    display: flex;

    align-items: flex-end;

    justify-content: space-between;

    gap: 1.5rem;

    margin-bottom: 0.85rem;
}

.ai-message-usage-labels {
    display: flex;

    flex-direction: column;

    gap: 0.3rem;

    min-width: 0;
}

.usage-label {
    display: block;

    color: var(--text);

    font-size: 1rem;

    line-height: 1.3;

    font-weight: 650;
}

.ai-message-usage-header small {
    display: block;

    color: var(--muted);

    font-size: 0.82rem;

    line-height: 1.3;

    font-weight: 500;
}

.ai-message-usage-value {
    flex-shrink: 0;

    color: var(--text);

    font-size: 1rem;

    line-height: 1.3;

    font-weight: 700;

    white-space: nowrap;
}

.usage-progress {
    width: 100%;

    height: 9px;

    border-radius: 999px;

    background: #EEF2F7;

    overflow: hidden;

    margin: 0;
}

.usage-progress span {
    display: block;

    height: 100%;

    border-radius: inherit;

    background: var(--accent);
}

.plan-summary-actions {
    display: flex;

    align-items: center;

    margin-top: 1.5rem;

    padding-top: 0;
}

.plan-summary-actions .button {
    margin: 0;
}


/* ============================================================
   AUTH
   ============================================================ */

.auth-shell {
    display: flex;

    justify-content: center;

    align-items: center;

    min-height: calc(100vh - 220px);

    padding: 2rem 0;
}

.auth-card {
    width: min(100%, 480px);

    margin: 0 auto;

    padding: 2rem;
}

.auth-card h2 {
    margin-top: 0;

    margin-bottom: 0.5rem;
}

.auth-card form {
    display: grid;

    gap: 0.75rem;
}

.auth-card form p {
    margin: 0;
}

.auth-divider {
    display: flex;

    align-items: center;

    justify-content: center;

    margin: 1rem 0;

    color: var(--muted);

    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';

    flex: 1;

    height: 1px;

    background: #E5E5E5;

    margin: 0 0.75rem;
}

.oauth-btn {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 0.75rem;

    width: 100%;

    padding: 0.95rem 1rem;

    margin-bottom: 0.25rem;

    border-radius: 14px;

    border: 1px solid #DCDCDC;

    background: #FFFFFF;

    color: var(--text);

    font-weight: 600;

    text-decoration: none;
}

.oauth-btn svg {
    width: 20px;

    height: 20px;
}


/* ============================================================
   HERO VISUAL
   ============================================================ */

.hero-visual {
    position: relative;

    overflow: hidden;

    max-width: 460px;

    width: 100%;

    margin-left: auto;
}

.hero-visual::before {
    content: '';

    position: absolute;

    inset: -20%;

    background:
        radial-gradient(
            circle,
            rgba(37, 99, 235, 0.06),
            transparent 60%
        );

    pointer-events: none;
}

.preview-shell {
    position: relative;

    z-index: 1;

    border-radius: 20px;

    border: 1px solid var(--border);

    padding: 1rem;

    background: #FFFFFF;

    display: flex;

    flex-direction: column;
}

.status-bar {
    display: flex;

    align-items: center;

    gap: 0.38rem;

    margin-bottom: 1rem;

    padding-bottom: 0.85rem;

    border-bottom: 1px solid var(--border);
}

.status-dot {
    width: 8px;

    height: 8px;

    border-radius: 50%;

    background: #D1D5DB;
}

.status-label {
    margin-left: 0.5rem;

    color: var(--muted);

    font-size: 0.84rem;
}

.preview-bubble {
    display: block;

    width: fit-content;

    padding: 0.48rem 0.75rem;

    border-radius: 12px;

    margin-bottom: 0.5rem;

    max-width: 72%;

    background: #F3F4F6;

    color: var(--text);

    line-height: 1.35;
}

.preview-bubble.user {
    align-self: flex-end;

    margin-left: 0;

    background: #EEF4FF;

    color: var(--text);
}

.preview-input {
    padding: 0.85rem 0.95rem;

    border-radius: 10px;

    background: #F9FAFB;

    border: 1px solid var(--border);

    color: var(--muted);

    margin-top: 0.75rem;
}


/* ============================================================
   UPLOAD LIST
   ============================================================ */

.upload-item {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 0.75rem;

    padding: 0.55rem 0.65rem;

    border-radius: 10px;

    background: #F9FAFB;

    border: 1px solid var(--border);

    margin-bottom: 8px;
}

.upload-item .fname {
    font-weight: 600;
}

.upload-item .fstatus {
    color: var(--muted);

    font-size: 0.9rem;

    margin-top: 4px;
}

.upload-left {
    display: flex;

    flex-direction: column;
}

.progress {
    width: 160px;

    height: 6px;

    background: #E5E7EB;

    border-radius: 6px;

    overflow: hidden;
}

.progress .bar {
    height: 100%;

    background:
        linear-gradient(
            90deg,
            var(--accent),
            var(--accent-2)
        );

    width: 0;
}


/* ============================================================
   PROCESSING MODAL
   ============================================================ */

.processing-modal {
    display: none;

    position: fixed;

    inset: 0;

    z-index: 9999;
}

.processing-modal__overlay {
    position: absolute;

    inset: 0;

    background: rgba(23, 23, 23, 0.42);

    backdrop-filter: blur(3px);

    -webkit-backdrop-filter: blur(3px);
}

.processing-modal__dialog {
    position: fixed;

    z-index: 10000;

    left: 50%;

    top: 50%;

    transform: translate(-50%, -50%);

    width: min(680px, calc(100% - 32px));

    max-height: 80vh;

    overflow: auto;

    background: #FFFFFF;

    color: var(--text);

    border: 1px solid var(--border);

    border-radius: 16px;

    padding: 1.4rem;

    box-shadow:
        0 20px 60px rgba(17, 24, 39, 0.18);

    animation: processingModalIn 0.18s ease-out;
}

#processing-modal-title {
    display: flex;

    align-items: center;

    gap: 0.55rem;
}

.processing-hourglass {
    display: inline-block;

    font-size: 1.15rem;

    line-height: 1;

    animation: hourglassSpin 1.4s ease-in-out infinite;

    transform-origin: center;
}

@keyframes hourglassSpin {

    0% {
        transform: rotate(0deg);
    }

    45% {
        transform: rotate(0deg);
    }

    55% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(180deg);
    }

}

.processing-modal-list {
    max-height: 50vh;

    overflow: auto;

    margin-top: 1rem;

    display: flex;

    flex-direction: column;

    gap: 0.55rem;
}

.modal-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    padding: 0.7rem 0.8rem;

    border-radius: 10px;

    background: #F9FAFB;

    border: 1px solid var(--border);

    color: var(--text);
}

.modal-row strong {
    font-size: 0.9rem;

    font-weight: 600;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color: var(--text);
}

.modal-row .mstatus {
    color: var(--muted);

    font-size: 0.82rem;

    white-space: nowrap;

    font-weight: 500;
}

.processing-modal-actions {
    display: flex;

    gap: 0.6rem;

    justify-content: flex-end;

    margin-top: 1.1rem;

    padding-top: 1rem;

    border-top: 1px solid var(--border);
}

@keyframes processingModalIn {

    from {
        opacity: 0;

        transform:
            translate(-50%, -48%)
            scale(0.98);
    }

    to {
        opacity: 1;

        transform:
            translate(-50%, -50%)
            scale(1);
    }

}


/* ============================================================
   SECTIONS
   ============================================================ */

.section-panel {
    margin-top: 1.4rem;

    padding: 1.6rem;

    border: 1px solid var(--border);

    border-radius: 20px;

    background: #fff;

    box-shadow: var(--shadow-soft);
}

.section-header {
    display: flex;

    justify-content: space-between;

    align-items: end;

    gap: 1rem;

    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;

    font-size: 1.45rem;
}

.feature-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 1rem;
}

.feature-grid-4 {
    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );
}

.feature-card h3,
.process-step h3,
.plan-card h3 {
    margin-bottom: 0.45rem;
}

.process-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 1rem;
}

.process-step {
    padding: 1.2rem;

    border-radius: 16px;

    background: #F9FAFB;

    border: 1px solid var(--border);
}

.process-step strong {
    display: inline-block;

    margin-bottom: 0.7rem;

    color: var(--accent);
}


/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-preview {
    display: grid;

    grid-template-columns:
        1.05fr
        0.95fr;

    gap: 1rem;
}

.metric-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 0.9rem;
}

.metric-card {
    min-height: 110px;

    display: flex;

    flex-direction: column;

    justify-content: space-between;

    padding: 1rem;

    border-radius: 12px;

    background: var(--panel-alt);

    border: 1px solid var(--border);

    box-shadow: none;
}

.metric-card span {
    color: var(--muted);

    font-size: 0.9rem;
}

.metric-card strong {
    font-size: 1.35rem;

    color: var(--text);
}

.bot-list {
    display: grid;

    gap: 0.75rem;
}

.bot-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    padding: 0.9rem 1rem;

    border-radius: 16px;

    background: #F9FAFB;

    border: 1px solid var(--border);
}

.bot-row p {
    margin: 0.2rem 0 0;

    color: var(--muted);
}

.bot-row-meta {
    display: flex;

    gap: 0.8rem;

    align-items: center;

    flex-wrap: wrap;
}


/* ============================================================
   PILLS
   ============================================================ */

.pill {
    display: inline-flex;

    align-items: center;

    padding: 0.4rem 0.7rem;

    border-radius: 999px;

    background: #F3F4F6;

    color: var(--muted);

    font-size: 0.8rem;
}

.pill-live {
    color: var(--success);

    background: rgba(34, 197, 94, 0.12);
}


/* ============================================================
   PLAN CARDS
   ============================================================ */

.plan-card {
    display: flex;

    flex-direction: column;

    height: 100%;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.plan-card:hover {
    transform: translateY(-4px);

    border-color: rgba(59, 130, 246, 0.28);
}

.plan-card.highlight {
    border-color: rgba(59, 130, 246, 0.42);

    box-shadow:
        0 20px 40px rgba(59, 130, 246, 0.14);
}

.plan-actions {
    margin-top: auto;

    padding-top: 1rem;
}

.plan-actions form {
    width: 100%;
}

.plan-actions .button {
    width: 100%;
}

.price {
    font-size: 2rem;

    font-weight: 700;

    margin: 0.6rem 0;
}

.price span {
    font-size: 0.95rem;

    color: var(--muted);
}


/* ============================================================
   DASHBOARD SHELL
   ============================================================ */

.dashboard-shell {
    display: grid;

    grid-template-columns: 250px 1fr;

    gap: 1.2rem;
}

.sidebar {
    padding: 1rem;

    border-radius: 16px;

    background: #fff;

    border: 1px solid var(--border);

    align-self: start;

    box-shadow: var(--shadow-soft);
}

.sidebar-brand {
    margin-bottom: 1rem;
}

.sidebar-nav {
    display: grid;

    gap: 0.35rem;
}

.sidebar-nav a {
    padding: 0.75rem 0.8rem;

    border-radius: 10px;

    color: var(--muted);

    font-weight: 500;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    color: var(--accent);

    background: #EEF4FF;

    border: 1px solid #DDEBFF;
}

.dashboard-main {
    display: grid;

    gap: 1rem;
}

.dashboard-header {
    padding: 0.5rem 0 0;
}


/* ============================================================
   SUCCESS BANNER
   ============================================================ */

.success-banner {
    border-color: rgba(34, 197, 94, 0.22);

    background: rgba(34, 197, 94, 0.08);

    position: relative;

    padding-right: 44px;
}

.success-banner .close-banner {
    position: absolute;

    right: 12px;

    top: 12px;

    border: none;

    background: transparent;

    color: var(--text);

    font-size: 1.1rem;

    cursor: pointer;
}


/* ============================================================
   STAT GRID
   ============================================================ */

.stat-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 1rem;
}


/* ============================================================
   COMPACT ACTIONS
   ============================================================ */

.compact-actions {
    margin: 0;

    gap: 0.5rem;
}

.compact-actions .button {
    padding: 0.7rem 0.9rem;

    font-size: 0.9rem;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
}


/* ============================================================
   BUILDER
   ============================================================ */

.builder-shell {
    display: grid;

    grid-template-columns:
        280px
        1fr;

    gap: 1.2rem;

    align-items: start;
}

.builder-shell-full {
    grid-template-columns: 1fr;
}

.builder-shell-full .builder-main {
    width: 100%;

    max-width: none;
}

.widget-page-shell {
    width: 100%;

    max-width: 100%;

    min-width: 0;

    overflow-x: hidden;
}

.widget-page-card {
    width: 100%;

    max-width: none;

    min-width: 0;

    overflow: hidden;

    overflow-wrap: anywhere;
}


/* ============================================================
   WIDGET DEPLOY PAGE
   ============================================================ */

.widget-page-card .eyebrow {
    margin-bottom: 0.65rem;
}

.widget-page-card h2 {
    margin-top: 0;

    margin-bottom: 0.55rem;

    font-size: 1.75rem;

    line-height: 1.25;

    letter-spacing: -0.025em;
}

.widget-page-card .hero-copy {
    margin-top: 0;

    margin-bottom: 1.4rem;

    max-width: 700px;

    font-size: 0.98rem;

    line-height: 1.65;

    color: var(--muted);
}


/*
   IMPORTANT:
   HTML uses .widget-code-wrapper.
   Previously CSS was targeting .widget-snippet-wrapper,
   so the positioning styles were not being applied.
*/

.widget-code-wrapper {
    position: relative;

    width: 100%;

    min-width: 0;

    margin-top: 1.25rem;

    overflow: hidden;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: #F3F4F6;
}


/* CODE HEADER */

.widget-code-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 0.75rem;

    min-height: 48px;

    padding: 0.65rem 0.75rem;

    border-bottom: 1px solid var(--border);

    background: #F9FAFB;
}

.widget-code-label {
    color: var(--muted);

    font-size: 0.78rem;

    font-weight: 700;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}


/* CODE BLOCK */

.widget-page-card .widget-snippet {
    display: block;

    width: 100%;

    max-width: 100%;

    min-width: 0;

    margin: 0;

    padding: 1rem;

    border: 0;

    border-radius: 0;

    background: #F3F4F6;

    color: var(--text);

    font-family:
        'SFMono-Regular',
        Consolas,
        'Liberation Mono',
        Menlo,
        monospace;

    font-size: 0.84rem;

    line-height: 1.55;

    white-space: pre-wrap;

    word-break: break-word;

    overflow-wrap: anywhere;

    overflow-x: hidden;

    tab-size: 2;
}


/* COPY BUTTON */

.widget-copy-button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 0.4rem;

    flex-shrink: 0;

    min-width: 78px;

    height: 34px;

    padding: 0 0.7rem;

    border: 1px solid var(--border);

    border-radius: 8px;

    background: #fff;

    color: var(--muted);

    cursor: pointer;

    font-family: inherit;

    font-size: 0.78rem;

    font-weight: 600;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease;
}

.widget-copy-button:hover {
    background: #F3F4F6;

    color: var(--text);

    border-color: #D0D0D0;
}

.widget-copy-button:active {
    transform: scale(0.97);
}

.widget-copy-button.copied {
    background: #F0FDF4;

    border-color: #BBF7D0;

    color: var(--success);
}

.widget-copy-icon {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    font-size: 0.95rem;

    line-height: 1;
}

.widget-copy-text {
    line-height: 1;
}


/* COPY TOOLTIP */

.widget-copy-button::after {
    content: 'Copy';

    position: absolute;

    right: 10px;

    top: -32px;

    padding: 5px 8px;

    border-radius: 6px;

    background: #171717;

    color: #fff;

    font-size: 0.72rem;

    font-weight: 500;

    white-space: nowrap;

    opacity: 0;

    pointer-events: none;

    transition: opacity 0.15s ease;
}

.widget-copy-button:hover::after {
    opacity: 1;
}

.widget-copy-button.copied::after {
    content: 'Copied';
}


/* HELPER LIST */

.widget-page-card .helper-list {
    margin-top: 1.4rem;

    margin-bottom: 0;

    color: var(--muted);

    line-height: 1.8;

    overflow-wrap: anywhere;
}

.widget-page-card .helper-list li {
    padding-left: 0.15rem;

    margin-bottom: 0.15rem;
}

.widget-page-card .helper-list code {
    padding: 0.12rem 0.35rem;

    border-radius: 5px;

    background: #F3F4F6;

    border: 1px solid var(--border);

    color: var(--text);

    font-size: 0.82em;
}


/* ============================================================
   BUILDER SIDEBAR
   ============================================================ */

.builder-sidebar {
    display: grid;

    gap: 0.8rem;
}

.builder-step {
    padding: 1rem;
}

.builder-step.active {
    border-color: rgba(59, 130, 246, 0.35);
}

.builder-step strong {
    display: inline-block;

    margin-bottom: 0.2rem;

    color: var(--accent);
}

.builder-step p {
    margin: 0;

    color: var(--muted);
}

.builder-main {
    padding: 1.6rem;
}


/* ============================================================
   FORMS
   ============================================================ */

.form-grid p {
    display: grid;

    gap: 0.45rem;

    margin-bottom: 1rem;
}

label {
    color: var(--muted);

    font-size: 0.92rem;
}

input,
textarea,
select {
    width: 100%;

    padding: 0.8rem 0.9rem;

    border-radius: 10px;

    border: 1px solid #DCDCDC;

    background: #fff;

    color: var(--text);

    margin-top: 0.25rem;
}

.field-error {
    margin: 0.35rem 0 0;

    color: var(--error);

    font-size: 0.88rem;

    line-height: 1.3;
}

.form-grid {
    display: grid;

    gap: 1rem;
}

.form-field label {
    display: block;

    margin-bottom: 0.35rem;

    color: var(--muted);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;

    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.08);
}

textarea {
    min-height: 120px;
}

pre {
    padding: 1rem;

    border-radius: 12px;

    background: #F3F4F6;

    overflow-x: auto;

    color: var(--text);

    line-height: 1.6;

    border: 1px solid var(--border);
}

.helper-list {
    color: var(--muted);

    line-height: 1.8;

    padding-left: 1.1rem;
}


/* ============================================================
   PREVIEW / CHAT
   ============================================================ */

.preview-panel {
    padding: 1.2rem;

    border: 1px solid var(--border);

    display: flex;

    flex-direction: column;

    height: 480px;

    max-height: 80vh;

    background: #fff;

    border-radius: 16px;
}

.preview-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 0.8rem;

    margin-bottom: 1rem;

    color: var(--text);
}

.preview-header span {
    color: var(--muted);

    font-size: 0.9rem;
}

.preview-body {
    display: flex;

    flex-direction: column;

    gap: 0.25rem;

    margin-top: 0.5rem;

    overflow-y: auto;

    flex: 1 1 auto;

    padding-right: 8px;

    scroll-behavior: smooth;
}


/* ============================================================
   CHAT MESSAGE
   ============================================================ */

.bubble {
    position: relative;

    width: fit-content;

    max-width: 78%;

    margin-top: 0.45rem;

    color: var(--text);

    line-height: 1.6;

    animation: fadeIn 0.22s ease;
}

.bubble-text {
    padding: 0.85rem 1rem;

    border-radius: 14px;

    background: #F3F4F6;

    overflow-wrap: anywhere;

    word-break: break-word;
}

.bubble.bot {
    align-self: flex-start;
}

.bubble.bot .bubble-text {
    background: #F3F4F6;

    border-top-left-radius: 5px;
}

.bubble.user {
    align-self: flex-end;

    margin-left: auto;
}

.bubble.user .bubble-text {
    background: #EEF4FF;

    border-top-right-radius: 5px;
}


/* ============================================================
   MESSAGE TIMESTAMP
   ============================================================ */

.message-time {
    display: block;

    margin-top: 0.25rem;

    padding: 0 0.35rem;

    color: rgba(148, 163, 184, 0.72);

    font-size: 0.68rem;

    font-weight: 400;

    line-height: 1.2;

    white-space: nowrap;

    letter-spacing: 0.01em;
}

.bubble.bot .message-time {
    text-align: left;
}

.bubble.user .message-time {
    text-align: right;
}


/* ============================================================
   TYPING INDICATOR
   ============================================================ */

.bubble.typing {
    position: relative;

    width: 62px;

    min-height: 38px;

    padding: 0.85rem 1rem;

    border-radius: 16px;

    border-top-left-radius: 5px;

    background: #F3F4F6;

    margin-top: 0.45rem;
}

.bubble.typing::after {
    content: '';

    display: inline-block;

    width: 6px;

    height: 6px;

    margin-left: 0;

    border-radius: 50%;

    background: #8ab7ff;

    box-shadow:
        10px 0 0 transparent,
        20px 0 0 transparent;

    animation:
        ellipsis
        1s
        infinite
        steps(4, end);
}


/* ============================================================
   MESSAGE TEXT FORMATTING
   ============================================================ */

.bubble-text p {
    margin: 0 0 0.65rem;
}

.bubble-text p:last-child {
    margin-bottom: 0;
}

.bubble-text h1,
.bubble-text h2,
.bubble-text h3,
.bubble-text h4,
.bubble-text h5,
.bubble-text h6 {
    margin-top: 0;

    margin-bottom: 0.55rem;

    color: var(--text);

    line-height: 1.3;
}

.bubble-text h1 {
    font-size: 1.25rem;
}

.bubble-text h2 {
    font-size: 1.15rem;
}

.bubble-text h3 {
    font-size: 1.05rem;
}

.bubble-text strong {
    color: var(--text);

    font-weight: 700;
}


/* ============================================================
   CHAT SCROLLBAR
   ============================================================ */

.preview-body::-webkit-scrollbar {
    width: 6px;
}

.preview-body::-webkit-scrollbar-track {
    background: transparent;
}

.preview-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);

    border-radius: 999px;
}

.preview-body::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.35);
}


/* ============================================================
   CHAT FORM
   ============================================================ */

.chat-form {
    display: grid;

    grid-template-columns:
        1fr
        auto;

    gap: 0.8rem;

    margin-top: 1rem;
}

.chat-form input {
    padding: 0.95rem 1rem;

    border-radius: 10px;

    background: #fff;

    color: var(--text);
}

.chat-form button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-height: 44px;

    padding: 0 1rem;

    border-radius: 10px;

    background: #171717;

    color: #fff;

    border: 1px solid #171717;

    cursor: pointer;
}

.chat-footer-note {
    margin-top: 1rem;

    padding-top: 1rem;

    border-top: 1px solid var(--border);

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    font-size: 0.84rem;

    color: var(--muted);
}


/* ============================================================
   MESSAGES
   ============================================================ */

.message-list {
    display: grid;

    gap: 0.75rem;

    margin-bottom: 1rem;
}

.message {
    padding: 0.85rem 1rem;

    border-radius: 14px;

    border: 1px solid var(--border);

    background: #F9FAFB;

    color: var(--text);
}

.message.error {
    border-color: rgba(248, 113, 113, 0.3);

    background: rgba(248, 113, 113, 0.12);

    color: #991B1B;
}


/* ============================================================
   FORM ACTIONS
   ============================================================ */

.form-actions {
    margin-top: 16px;

    display: flex;

    justify-content: center;

    gap: 12px;
}

.field-group input[type="checkbox"] {
    width: 18px;

    height: 18px;
}


/* ============================================================
   DOCUMENTS
   ============================================================ */

.documents-list {
    margin-top: 8px;

    display: flex;

    flex-direction: column;

    gap: 8px;
}

.documents-list .doc-item {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 8px;
}

.documents-list .doc-item button {
    background: transparent;

    border: 1px solid var(--border);

    color: var(--muted);

    padding: 6px 8px;

    border-radius: 8px;

    cursor: pointer;
}


/* ============================================================
   DOMAIN MANAGEMENT
   ============================================================ */

#add-domain-dashboard {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 0.75rem;

    margin-top: 1rem;

    margin-bottom: 1rem;
}

#add-domain-dashboard input {
    width: 100%;

    min-width: 0;

    margin-top: 0;
}

#add-domain-dashboard .button {
    margin: 0;

    white-space: nowrap;

    min-height: 46px;
}

#domain-message {
    grid-column: 1 / -1;

    min-height: 1.2rem;

    color: var(--muted);

    font-size: 0.88rem;
}

.domain-limit-text {
    margin-top: 1rem;
}

#domain-list {
    display: grid;

    gap: 0.6rem;

    padding-left: 0;

    margin: 1rem 0 0;

    list-style: none;
}

#domain-list li {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 1rem;

    padding: 0.75rem 0.85rem;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: #F9FAFB;
}

.domain-name {
    min-width: 0;

    overflow-wrap: anywhere;

    word-break: break-word;

    color: var(--text);
}

#domain-list .remove-domain {
    flex-shrink: 0;

    padding: 0.55rem 0.8rem;

    font-size: 0.82rem;
}

.domain-subheading {
    margin: 1.25rem 0 0.75rem;

    font-size: 0.92rem;

    letter-spacing: 0.06em;

    text-transform: uppercase;

    color: var(--muted);
}


/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    margin-top: 3rem;

    padding: 1.5rem 0 2rem;

    border-top: 1px solid var(--border);
}

.footer-shell {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    flex-wrap: wrap;

    max-width: 1280px;

    margin: 0 auto;

    padding: 0 1.5rem;

    color: var(--muted);
}

.footer-links {
    display: flex;

    gap: 1rem;

    flex-wrap: wrap;
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {

    from {
        opacity: 0;

        transform: translateY(8px);
    }

    to {
        opacity: 1;

        transform: translateY(0);
    }

}

@keyframes ellipsis {

    0% {
        box-shadow:
            10px 0 0 transparent,
            20px 0 0 transparent;
    }

    25% {
        box-shadow:
            10px 0 0 #8ab7ff,
            20px 0 0 transparent;
    }

    50% {
        box-shadow:
            10px 0 0 #8ab7ff,
            20px 0 0 #8ab7ff;
    }

    75% {
        box-shadow:
            10px 0 0 #8ab7ff,
            20px 0 0 #8ab7ff;
    }

    100% {
        box-shadow:
            10px 0 0 #8ab7ff,
            20px 0 0 #8ab7ff;
    }

}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1080px) {

    .hero,
    .dashboard-preview,
    .dashboard-shell,
    .builder-shell,
    .feature-grid-4 {
        grid-template-columns: 1fr;
    }

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

}


@media (max-width: 820px) {

    .topbar-inner {
        flex-wrap: wrap;

        align-items: center;
    }

    .topbar-nav {
        gap: 0.75rem;

        display: none;
    }

    .desktop-actions {
        display: none;
    }

    .topbar-burger {
        display: inline-flex;
    }

    .topbar-collapse {
        width: 100%;

        flex-direction: column;

        align-items: stretch;

        display: none;

        margin-top: 0.75rem;

        padding: 1rem;

        border: 1px solid var(--border);

        border-radius: 20px;

        background: #FFFFFF;

        min-height: 10rem;

        justify-content: space-between;
    }

    .topbar.nav-open .topbar-collapse {
        display: flex;
    }

    .mobile-nav {
        display: flex;

        flex-direction: column;

        gap: 0.75rem;

        margin-bottom: 1rem;

        width: 100%;
    }

    .mobile-actions {
        width: 100%;

        flex-direction: row;

        gap: 0.75rem;

        justify-content: space-between;

        margin-top: auto;
    }

    .mobile-actions .button,
    .mobile-actions .nav-pill {
        width: auto;

        flex: 1;
    }

    .topbar-left {
        gap: 1rem;
    }

}


@media (max-width: 800px) {

    .dashboard-main {
        min-width: 0;
    }

    .dashboard-main > .card,
    .dashboard-main > .stat-grid {
        min-width: 0;
    }

    .responsive-table {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .responsive-table table {
        min-width: 620px;
    }

    .responsive-table th,
    .responsive-table td {
        white-space: nowrap;
    }

    .dashboard-main .empty-state {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .dashboard-main .section-header {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .page {
        padding: 1.2rem 1rem 3rem;
    }

    .widget-page-card {
        padding: 1.1rem;

        border-radius: 18px;
    }

    .widget-page-card h2 {
        font-size: 1.45rem;

        line-height: 1.25;
    }

    .widget-page-card .hero-copy {
        font-size: 1rem;
    }

    .widget-code-wrapper {
        margin-top: 1rem;

        border-radius: 10px;
    }

    .widget-code-header {
        min-height: 46px;

        padding: 0.6rem;
    }

    .widget-page-card .widget-snippet {
        padding: 0.85rem;

        font-size: 0.78rem;

        line-height: 1.5;
    }

    .widget-copy-button {
        min-width: 72px;

        height: 32px;

        font-size: 0.75rem;
    }

    .topbar {
        flex-direction: column;

        align-items: flex-start;

        gap: 0.75rem;
    }

    .hero {
        gap: 1.4rem;
    }

    .feature-grid,
    .feature-grid-3,
    .process-grid,
    .metric-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .bot-row {
        flex-direction: column;

        align-items: flex-start;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .dropzone {
        align-items: stretch !important;
        flex-direction: column;
    }

    .dropzone .button {
        width: 100%;
    }

    .documents-list .doc-item {
        align-items: flex-start !important;
        flex-wrap: wrap;
    }

    .documents-list .doc-item > div {
        min-width: 0;
        overflow-wrap: anywhere;
    }

}


@media (max-width: 600px) {

    .dashboard-main {
        overflow-x: hidden;
    }

    .dashboard-main .card-body {
        padding: 1rem;
    }

    .responsive-table table {
        min-width: 560px;
    }

    .danger-zone {
        overflow-wrap: anywhere;
    }

    .confirmation-modal__dialog {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    .ai-message-usage-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 0.6rem;
    }

    .ai-message-usage-value {
        font-size: 0.95rem;
    }

    #add-domain-dashboard {
        grid-template-columns: 1fr;

        gap: 0.7rem;
    }

    #add-domain-dashboard .button {
        width: 100%;
    }

    #domain-list li {
        align-items: flex-start;

        flex-direction: column;
    }

    #domain-list .remove-domain {
        width: 100%;
    }

    .widget-page-card {
        padding: 1rem;
    }

    .widget-page-card h2 {
        font-size: 1.3rem;
    }

    .widget-page-card .hero-copy {
        font-size: 0.92rem;

        line-height: 1.55;
    }

    .widget-code-header {
        padding: 0.55rem;
    }

    .widget-code-label {
        font-size: 0.7rem;
    }

    .widget-copy-button {
        min-width: 68px;

        padding: 0 0.55rem;
    }

    .widget-page-card .widget-snippet {
        padding: 0.75rem;

        font-size: 0.72rem;

        line-height: 1.45;
    }

    .widget-copy-button::after {
        display: none;
    }

}


/* ============================================================
   GLOBAL DJANGO MESSAGES
   ============================================================ */

.global-messages {
    position: fixed;

    top: 90px;

    right: 24px;

    z-index: 99999;

    width: min(440px, calc(100vw - 32px));

    display: flex;

    flex-direction: column;

    gap: 0.75rem;

    pointer-events: none;
}

.global-message {
    position: relative;

    display: flex;

    align-items: flex-start;

    gap: 1rem;

    padding: 1rem 3rem 1rem 1.1rem;

    border-radius: 16px;

    background: rgba(255, 255, 255, 0.97);

    border: 1px solid var(--border);

    color: var(--text);

    box-shadow:
        0 20px 50px rgba(2, 8, 23, 0.12);

    pointer-events: auto;

    animation: globalMessageIn 0.25s ease-out;
}

.global-message-content {
    flex: 1;

    font-size: 0.92rem;

    line-height: 1.5;
}

.global-message-error {
    border-color: rgba(248, 113, 113, 0.35);

    background: #FEF2F2;

    color: #991B1B;
}

.global-message-success {
    border-color: rgba(34, 197, 94, 0.30);

    background: #F0FDF4;

    color: #166534;
}

.global-message-warning {
    border-color: rgba(251, 191, 36, 0.30);

    background: #FFFBEB;

    color: #92400E;
}

.global-message-info {
    border-color: rgba(59, 130, 246, 0.30);

    background: #EFF6FF;

    color: #1E40AF;
}

.global-message-close {
    position: absolute;

    top: 8px;

    right: 10px;

    width: 28px;

    height: 28px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 0;

    border: none;

    border-radius: 8px;

    background: transparent;

    color: currentColor;

    font-size: 1.35rem;

    line-height: 1;

    cursor: pointer;

    opacity: 0.7;

    transition:
        background 0.2s ease,
        opacity 0.2s ease;
}

.global-message-close:hover {
    background: rgba(0, 0, 0, 0.06);

    opacity: 1;
}

.global-message.is-closing {
    animation:
        globalMessageOut
        0.22s
        ease
        forwards;
}

@keyframes globalMessageIn {

    from {
        opacity: 0;

        transform: translateY(-8px);
    }

    to {
        opacity: 1;

        transform: translateY(0);
    }

}

@keyframes globalMessageOut {

    from {
        opacity: 1;

        transform: translateY(0);
    }

    to {
        opacity: 0;

        transform: translateY(-8px);
    }

}


@media (max-width: 600px) {

    .global-messages {
        top: 75px;

        right: 16px;

        width: calc(100vw - 32px);
    }

    .global-message {
        padding:
            0.9rem
            2.8rem
            0.9rem
            1rem;
    }

}


/* ============================================================
   DASHBOARD / PREVIEW EXTRAS
   ============================================================ */

.dashboard-metrics-panel .dashboard-panel-header {
    margin-bottom: 1.2rem;
}

.dashboard-panel .dashboard-panel-header {
    margin-bottom: 1.2rem;
}

.preview-send-button {
    width: 100%;

    margin-top: 0.7rem;

    background: #171717;

    color: #fff;

    border: 1px solid #171717;
}

.preview-send-button:hover {
    background: #171717;

    color: #fff;
}


/* ============================================================
   KNOWLEDGE UPLOAD HIGHLIGHT
   ============================================================ */

#knowledge-upload.highlight-upload {
    position: relative;

    border: 2px solid var(--accent);

    box-shadow:
        0 0 0 5px rgba(37, 99, 235, 0.10),
        0 12px 35px rgba(37, 99, 235, 0.15);

    animation: knowledgeHighlightPulse 3s ease-in-out;
}

#knowledge-upload.highlight-upload::before {
    content: 'START HERE';

    position: absolute;

    top: -13px;

    left: 24px;

    padding: 0.25rem 0.7rem;

    border-radius: 999px;

    background: var(--accent);

    color: #fff;

    font-size: 0.72rem;

    font-weight: 700;

    letter-spacing: 0.04em;

    z-index: 2;
}

@keyframes knowledgeHighlightPulse {

    0% {
        box-shadow:
            0 0 0 0 rgba(37, 99, 235, 0);
    }

    25% {
        box-shadow:
            0 0 0 10px rgba(37, 99, 235, 0.18),
            0 12px 35px rgba(37, 99, 235, 0.20);
    }

    50% {
        box-shadow:
            0 0 0 5px rgba(37, 99, 235, 0.12),
            0 12px 35px rgba(37, 99, 235, 0.15);
    }

    75% {
        box-shadow:
            0 0 0 8px rgba(37, 99, 235, 0.15),
            0 12px 35px rgba(37, 99, 235, 0.18);
    }

    100% {
        box-shadow:
            0 0 0 5px rgba(37, 99, 235, 0.10),
            0 12px 35px rgba(37, 99, 235, 0.15);
    }

}

.google-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.google-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.brand span {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
}