:root {
    --bg-dark: #090d16;
    --bg-card: rgba(18, 25, 43, 0.90);
    --bg-card-hover: rgba(24, 34, 58, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(6, 182, 212, 0.3);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;

    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.25);
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.25);

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

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.06) 0px, transparent 50%);
}

/* APP LAYOUT */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 270px;
    background: rgba(13, 18, 32, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-info h2 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-domain {
    font-size: 11px;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    position: relative;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.nav-icon {
    font-size: 18px;
}

.badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-text {
    font-size: 12px;
    display: flex;
    flex-direction: column;
}

.status-text strong {
    color: var(--text-main);
}

.status-text span {
    color: var(--text-muted);
    font-size: 11px;
}

/* MAIN CONTENT */
.main-content {
    margin-left: 270px;
    flex: 1;
    padding: 32px 40px;
    max-width: 1500px;
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.topbar-title h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.topbar-title .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.topbar-actions {
    display: flex;
    gap: 12px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* TAB CONTENT */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-3px);
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(18, 25, 43, 0.8));
    border-color: rgba(245, 158, 11, 0.35);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent);
}

.stat-icon.gold {
    background: rgba(245, 158, 11, 0.18);
    color: var(--warning);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-data {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin: 2px 0;
}

.stat-sub {
    font-size: 12px;
    font-weight: 600;
}

.text-success {
    color: var(--success);
}

.text-gold {
    color: var(--warning);
}

.text-cyan {
    color: var(--primary);
}

.text-green {
    color: var(--success);
}

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

/* SECTION CARDS & TABLES */
.section-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 17px;
    font-weight: 700;
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

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

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.leads-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.leads-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.phone-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* FANPAGES GRID */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition);
}

.page-card:hover {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.page-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #1877f2, #0b5ed7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.page-title-box h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.page-category {
    font-size: 12px;
    color: var(--text-muted);
}

/* TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.page-meta {
    font-size: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-actions-row {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* INBOX LAYOUT */
.inbox-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
}

.inbox-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-filter {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inbox-filter input,
.inbox-filter select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: var(--transition);
}

.chat-item:hover,
.chat-item.active {
    background: rgba(255, 255, 255, 0.05);
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-sender {
    font-size: 14px;
    font-weight: 700;
}

.chat-time {
    font-size: 11px;
    color: var(--text-dark);
}

.chat-snippet {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    overflow-y: auto;
}

.detail-bubble {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 18px;
    border-left: 3px solid var(--primary);
}

.detail-bubble.bot {
    border-left-color: var(--accent);
    background: rgba(139, 92, 246, 0.05);
}

.detail-product-card {
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: var(--radius-md);
    margin-top: 12px;
    align-items: center;
}

.detail-product-img {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* SIMULATOR */
.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 32px;
    align-items: flex-start;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.btn-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-chip:hover {
    color: #fff;
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.1);
}

.rag-info-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 24px;
}

.phone-frame {
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 36px;
    height: 650px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
}

.phone-header {
    background: rgba(30, 41, 59, 0.9);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.phone-page-avatar {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-page-meta strong {
    font-size: 13.5px;
    display: block;
}

.phone-page-meta span {
    font-size: 11px;
    color: var(--success);
}

.phone-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
}

.msg-bubble.user {
    background: #0284c7;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-bubble.bot {
    background: #334155;
    color: #f8fafc;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.phone-input-bar {
    padding: 12px 16px;
    background: #1e293b;
    display: flex;
    gap: 8px;
}

.phone-input-bar input {
    flex: 1;
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    outline: none;
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

/* SETTINGS FORM */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.settings-card.full-width {
    grid-column: 1 / -1;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #cbd5e1;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: var(--transition);
}

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

.range-slider {
    width: 100%;
    accent-color: var(--primary);
    margin-top: 6px;
}

.webhook-info-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-label {
    width: 180px;
    font-size: 13px;
    color: var(--text-muted);
}

.code-badge {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
}

.badge-tag {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.settings-save-bar {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    border: 1px solid var(--primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==============================================================================
   LOGIN OVERLAY & SESSION AUTH
   ============================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, rgba(13, 20, 36, 0.95), #060911);
    backdrop-filter: blur(25px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: rgba(18, 25, 43, 0.92);
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(6, 182, 212, 0.15);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--success));
}

.login-logo {
    margin-bottom: 24px;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 18px;
    font-size: 32px;
    margin-bottom: 12px;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.login-logo h2 {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.pw-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.pw-input-wrapper input {
    padding-right: 44px;
    height: 48px;
    font-size: 15px;
}

.btn-toggle-pw {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.login-options {
    margin: 16px 0 20px 0;
    text-align: left;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.remember-label input {
    cursor: pointer;
    accent-color: var(--primary);
}

.login-error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 14px;
    min-height: 20px;
    font-weight: 500;
}

.login-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 12px;
}

.btn-logout {
    margin-top: 12px;
    width: 100%;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

/* ==============================================================================
   BOT SELECTOR BAR & QUICK CHIPS
   ============================================================================== */
.bot-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(18, 25, 43, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.bot-selector-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 280px;
}

.bot-selector-group label {
    white-space: nowrap;
    font-size: 14px;
    color: var(--text-main);
}

.bot-dropdown {
    flex: 1;
    background: #0f172a;
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
}

.bot-status-tag {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-pulse {
    background: #10b981 !important;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.btn-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-chip:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn-clear-chat {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    padding: 4px 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear-chat:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ==============================================================================
   MASTER BOT CARD
   ============================================================================== */
.master-bot-card {
    background: linear-gradient(145deg, rgba(18, 25, 43, 0.95), rgba(28, 22, 54, 0.7));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 32px;
    overflow: hidden;
}

.master-bot-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 16px;
}

.bot-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bot-big-avatar {
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 14px;
}

.master-bot-card .card-body {
    padding: 24px;
}

.pages-section-header {
    margin-bottom: 18px;
}

.pages-section-header h3 {
    font-size: 18px;
    font-weight: 700;
}

/* ==============================================================================
   REMOTE API CARD & TOKEN DISPLAY
   ============================================================================== */
.api-token-container {
    margin: 16px 0;
}

.token-input-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.code-text {
    font-family: monospace;
    font-size: 14px;
    background: #0b1120 !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
    color: var(--primary) !important;
    font-weight: 600;
}

.api-doc-snippet {
    margin-top: 20px;
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.code-block {
    margin-top: 8px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    overflow-x: auto;
}

.highlight-token {
    color: var(--primary);
    font-weight: bold;
}

/* ==============================================================================
   MOBILE & TABLET RESPONSIVE FIXES
   ============================================================================== */
.btn-hamburger {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-hamburger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-close-sidebar {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 992px) {
    .btn-hamburger {
        display: inline-flex;
    }

    .btn-close-sidebar {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        z-index: 100;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        width: 100%;
        max-width: 100%;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }

    .topbar-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-actions .btn {
        flex: 1;
        min-width: 130px;
        justify-content: center;
    }

    .simulator-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .phone-frame-wrapper {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .phone-frame {
        width: 100%;
        max-width: 480px;
        height: 600px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .inbox-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .inbox-sidebar {
        max-height: 320px;
    }

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

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .bot-selector-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .bot-selector-group {
        flex-direction: column;
        align-items: stretch;
    }

    .token-input-group {
        flex-direction: column;
    }

    .topbar-title h1 {
        font-size: 20px;
    }

    .phone-frame {
        height: 520px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}