/* ============================================================
   CMR FAROLES — PREMIUM DESIGN SYSTEM v2.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* --- TOKENS ------------------------------------------------ */
:root {
    /* Colors */
    --color-bg:           #07080f;
    --color-surface:      #0d0f1c;
    --color-surface-2:    #111326;
    --color-surface-3:    #161928;
    --color-border:       rgba(255,255,255,0.07);
    --color-border-hover: rgba(255,255,255,0.14);

    /* Brand Gradient — Instagram */
    --ig-grad: linear-gradient(135deg, #f09433 0%, #e6683c 20%, #dc2743 45%, #cc2366 75%, #bc1888 100%);
    --ig-grad-glow: 0 0 40px rgba(188,24,136,0.25);

    /* Accent Palette */
    --purple:     #8b5cf6;
    --purple-dim: rgba(139,92,246,0.15);
    --pink:       #ec4899;
    --pink-dim:   rgba(236,72,153,0.15);
    --blue:       #3b82f6;
    --blue-dim:   rgba(59,130,246,0.15);
    --green:      #22c55e;
    --green-dim:  rgba(34,197,94,0.15);
    --orange:     #f97316;
    --orange-dim: rgba(249,115,22,0.15);
    --yellow:     #eab308;
    --red:        #ef4444;

    /* Text */
    --text-primary:   #f0f1f8;
    --text-secondary: #8b90a8;
    --text-muted:     #4b5068;

    /* Typography */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;

    /* Layout */
    --sidebar-w: 268px;
    --radius-sm:  8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.45);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.55);
    --shadow-purple: 0 8px 24px rgba(139,92,246,0.25);
    --shadow-pink: 0 8px 24px rgba(236,72,153,0.2);
}

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

/* Global SVG fix — prevent browser default 300×150px size */
svg {
    display: block;
    overflow: hidden;
    max-width: 100%;
    flex-shrink: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* --- AMBIENT BACKGROUND ORBS ------------------------------ */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}
.orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, #7c3aed 0%, transparent 70%); top: -200px; left: -100px; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, #be185d 0%, transparent 70%); bottom: -150px; right: -50px; }
.orb-3 { width: 400px; height: 400px; background: radial-gradient(circle, #1d4ed8 0%, transparent 70%); top: 40%; left: 40%; }

/* --- APP SHELL -------------------------------------------- */
.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(13,15,28,0.85);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--color-border);
    padding: 20px 12px 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}
.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: var(--ig-grad-glow);
}
.brand-logo svg { width: 38px; height: 38px; }
.brand-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.brand-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* Section labels */
.sidebar-section-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin: 8px 0 6px;
}

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-btn {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
}
.nav-btn:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.nav-btn.active {
    background: rgba(139,92,246,0.12);
    color: var(--text-primary);
}
.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--purple), var(--pink));
    border-radius: 0 4px 4px 0;
}
.nav-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.2s;
}
.nav-icon svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    min-height: 16px;
}
.nav-btn.active .nav-icon {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    box-shadow: var(--shadow-purple);
}
.nav-btn.active .nav-icon svg { stroke: white; }
.nav-label { flex-grow: 1; }

.nav-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--pink);
    color: white;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}
.nav-pill {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(249,115,22,0.15);
    color: var(--orange);
    border: 1px solid rgba(249,115,22,0.3);
    padding: 2px 6px;
    border-radius: 20px;
}
.nav-btn--simulator .nav-icon {
    background: rgba(249,115,22,0.1);
}
.nav-btn--simulator .nav-icon svg { stroke: var(--orange); }
.nav-btn--simulator.active .nav-icon {
    background: linear-gradient(135deg, var(--orange), var(--yellow));
    box-shadow: 0 8px 24px rgba(249,115,22,0.3);
}

/* Sidebar footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
    flex-shrink: 0;
    animation: pulse 2s infinite;
}
.status-indicator.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================
   MAIN AREA & VIEWS
   ============================================================ */
.main-area {
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.view { display: none; flex: 1; overflow: hidden; }
.view.active { display: flex; flex-direction: column; animation: slideIn 0.3s ease; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Page header */
.view-page-header {
    padding: 28px 32px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}
.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); }

.test-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(249,115,22,0.12);
    color: var(--orange);
    border: 1px solid rgba(249,115,22,0.3);
    padding: 6px 12px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ============================================================
   GLASS CARDS & FORMS
   ============================================================ */
.glass-card {
    background: rgba(17,19,38,0.7);
    backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s;
}
.glass-card:hover { border-color: var(--color-border-hover); }

.card-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.card-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.card-icon svg {
    width: 20px !important;
    height: 20px !important;
    stroke: white;
}
.card-icon--purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: var(--shadow-purple); }
.card-icon--green  { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 8px 24px rgba(34,197,94,0.25); }
.card-icon--blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 8px 24px rgba(59,130,246,0.25); }
.card-icon--orange { background: linear-gradient(135deg, #f97316, #ea580c); box-shadow: 0 8px 24px rgba(249,115,22,0.25); }

.card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.field-input, .field-select, .field-textarea {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-main);
    outline: none;
    transition: all 0.25s;
    width: 100%;
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-muted); }
.field-input:focus, .field-select:focus, .field-textarea:focus {
    border-color: var(--purple);
    background: rgba(139,92,246,0.06);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.field-select option { background: var(--color-surface-2); }
.field-hint { font-size: 0.76rem; color: var(--text-muted); }

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: var(--shadow-purple);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(139,92,246,0.4); }
.btn-primary:active { transform: translateY(0); }
.w-full { width: 100%; }

.btn-simulator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--orange), #c2410c);
    color: white;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 8px 24px rgba(249,115,22,0.3);
}
.btn-simulator:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(249,115,22,0.45); }

/* Tags */
.tags-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-chip {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--purple-dim);
    color: #c4b5fd;
    border: 1px solid rgba(139,92,246,0.25);
}

/* Quick chips */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
    font-size: 0.78rem;
    font-weight: 500;
    padding: 5px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
}
.chip:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: var(--color-border-hover); }

/* @ field */
.at-field { display: flex; align-items: center; background: rgba(255,255,255,0.04); border: 1px solid var(--color-border); border-radius: var(--radius-sm); transition: all 0.25s; }
.at-field:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.12); }
.at-prefix { padding: 0 8px 0 14px; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
.at-input { border: none !important; background: transparent !important; box-shadow: none !important; }

/* Two column layout */
.two-col-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 24px 32px 32px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

/* ============================================================
   INBOX
   ============================================================ */
.inbox-wrap {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* Chat List Column */
.chat-list-col {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(13,15,28,0.6);
    border-right: 1px solid var(--color-border);
}
.col-header { padding: 20px 16px 12px; }
.col-title { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 10px; letter-spacing: -0.02em; }
.search-wrap { position: relative; }
.search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px !important;
    height: 15px !important;
    stroke: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 9px 12px 9px 34px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-main);
    outline: none;
    transition: all 0.25s;
}
.search-input:focus { border-color: var(--purple); background: rgba(139,92,246,0.06); }
.search-input::placeholder { color: var(--text-muted); }

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

/* Chat Item */
.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    position: relative;
}
.chat-item:hover { background: rgba(255,255,255,0.03); }
.chat-item.active { background: rgba(139,92,246,0.08); }
.chat-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--purple), var(--pink));
    border-radius: 0 3px 3px 0;
}

.chat-item-avatar {
    position: relative;
    flex-shrink: 0;
}
.chat-item-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-surface-3);
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.05);
}
.unread-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 50%;
    border: 2px solid var(--color-surface);
}

.chat-item-content { flex: 1; min-width: 0; }
.chat-item-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}
.chat-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item-time { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }
.chat-item-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-item-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.unread-badge {
    background: var(--pink);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    padding: 32px 16px;
    gap: 8px;
    text-align: center;
}
.empty-state svg {
    width: 40px !important;
    height: 40px !important;
    stroke: var(--text-muted);
    margin-bottom: 4px;
}
.empty-state p { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.empty-state span { font-size: 0.8rem; color: var(--text-muted); }

/* Chat Window */
.chat-win-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-win-header {
    padding: 0 20px;
    min-height: 64px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    background: rgba(13,15,28,0.5);
    flex-shrink: 0;
}
.chat-placeholder-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}
.placeholder-icon svg { width: 18px; height: 18px; }
.placeholder-icon { opacity: 0.5; }

.chat-active-header { display: flex; align-items: center; gap: 12px; width: 100%; }
.back-btn-chat {
    width: 34px; height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.2s;
}
.back-btn-chat svg { width: 18px !important; height: 18px !important; }
.back-btn-chat:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); }
.chat-header-avatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139,92,246,0.3);
}
.chat-header-info h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.chat-header-info p { font-size: 0.78rem; color: var(--text-muted); }
.chat-header-stage {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--purple-dim);
    color: #c4b5fd;
    border: 1px solid rgba(139,92,246,0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    text-align: center;
}
.chat-empty-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 4px;
    flex-shrink: 0;
}
.chat-empty-icon svg {
    width: 28px !important;
    height: 28px !important;
    stroke: var(--text-muted);
}
.chat-empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-secondary); }
.chat-empty-state p { font-size: 0.84rem; color: var(--text-muted); max-width: 240px; }

/* Message bubbles */
.msg-wrap { display: flex; flex-direction: column; gap: 2px; }
.msg-wrap.outgoing { align-items: flex-end; }
.msg-wrap.incoming { align-items: flex-start; }

.bubble {
    max-width: 62%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}
.bubble.incoming {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 5px;
    color: var(--text-primary);
}
.bubble.outgoing {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: var(--shadow-pink);
}
.bubble.auto-resp {
    background: rgba(236,72,153,0.08);
    border: 1px dashed rgba(236,72,153,0.4);
    color: #f9a8d4;
    border-bottom-right-radius: 5px;
}

.msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
}
.msg-meta .bot-label {
    font-size: 0.68rem;
    background: var(--pink-dim);
    color: var(--pink);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Composer */
.chat-composer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: rgba(13,15,28,0.5);
    flex-shrink: 0;
}
.composer-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: 26px;
    padding: 6px 6px 6px 18px;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.composer-inner:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.composer-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-main);
}
.composer-input::placeholder { color: var(--text-muted); }
.composer-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: var(--shadow-purple);
}
.composer-send:hover { transform: scale(1.08); }
.composer-send svg { width: 16px !important; height: 16px !important; }

/* Contact Detail Column */
.contact-detail-col {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(13,15,28,0.6);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
}
.detail-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.detail-header h3 { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.contact-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px 16px;
    border-bottom: 1px solid var(--color-border);
}
.contact-avatar-ring {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    padding: 3px;
    background: var(--ig-grad);
    margin-bottom: 4px;
}
.contact-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-bg);
    background: var(--color-surface-3);
}
.contact-profile h4 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.contact-username-text { font-size: 0.82rem; color: var(--text-muted); }
.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ============================================================
   PIPELINE / KANBAN
   ============================================================ */
.kanban-wrap {
    display: flex;
    gap: 16px;
    padding: 20px 32px 32px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
}

.kanban-col {
    min-width: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(13,15,28,0.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s;
}
.kanban-col.drag-over { border-color: var(--purple); background: rgba(139,92,246,0.04); }

.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.kanban-col-header--lead    { border-top: 3px solid var(--blue); }
.kanban-col-header--contacted { border-top: 3px solid var(--yellow); }
.kanban-col-header--customer { border-top: 3px solid var(--green); }
.kanban-col-header--lost    { border-top: 3px solid var(--red); }

.kanban-col-title { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 700; color: var(--text-primary); }
.col-dot { width: 8px; height: 8px; border-radius: 50%; }
.col-dot--lead { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.col-dot--contacted { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.col-dot--customer { background: var(--green); box-shadow: 0 0 6px var(--green); }
.col-dot--lost { background: var(--red); box-shadow: 0 0 6px var(--red); }

.col-count {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.k-card {
    background: rgba(22,25,40,0.9);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.k-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-md);
}
.k-card:active { cursor: grabbing; }
.k-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.k-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--color-surface-3); }
.k-info h5 { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.k-info span { font-size: 0.75rem; color: var(--text-muted); }
.k-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.k-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--text-secondary);
}

/* ============================================================
   AUTOMATION / RULES
   ============================================================ */
.rules-list { display: flex; flex-direction: column; gap: 10px; }
.rule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}
.rule-item:hover { border-color: var(--color-border-hover); }
.rule-keyword {
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--pink-dim);
    color: var(--pink);
    border: 1px solid rgba(236,72,153,0.25);
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.rule-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rule-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rule-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.rule-btn svg { width: 13px !important; height: 13px !important; }
.rule-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.rule-btn.danger:hover { background: rgba(239,68,68,0.1); color: var(--red); border-color: rgba(239,68,68,0.3); }
.rule-status {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}
.rule-status.inactive { background: var(--text-muted); box-shadow: none; }

/* ============================================================
   SETTINGS STEPS
   ============================================================ */
.steps-list { display: flex; flex-direction: column; gap: 16px; }
.step-item { display: flex; align-items: flex-start; gap: 14px; }
.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--purple-dim);
    border: 1px solid rgba(139,92,246,0.3);
    color: var(--purple);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.step-body { flex: 1; }
.step-body strong { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.code-block {
    display: block;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #c4b5fd;
    overflow-x: auto;
}

/* ============================================================
   SIMULATOR / TERMINAL
   ============================================================ */
.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    padding: 20px 32px 32px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.terminal-card { display: flex; flex-direction: column; }
.terminal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 14px;
    flex-shrink: 0;
}
.terminal-dots { display: flex; gap: 6px; }
.t-dot { width: 12px; height: 12px; border-radius: 50%; }
.t-dot--red    { background: #ff5f57; }
.t-dot--yellow { background: #febc2e; }
.t-dot--green  { background: #28c840; }
.terminal-title { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); margin-left: 4px; }
.terminal-body {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    overflow-y: auto;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.log-line { line-height: 1.5; word-break: break-all; }
.log-system { color: #475569; }
.log-info    { color: #38bdf8; }
.log-success { color: #4ade80; }
.log-warning { color: #fbbf24; }
.log-error   { color: #f87171; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;

    background: rgba(13,15,28,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--color-border);
    z-index: 200;
    padding: 0 8px;
    align-items: center;
    justify-content: space-around;
}
.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}
.mobile-nav-btn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor;
}
.mobile-nav-btn.active { color: var(--purple); }
.mobile-nav-btn.active svg { filter: drop-shadow(0 0 6px rgba(139,92,246,0.6)); }
.mobile-nav-btn--sim.active { color: var(--orange); }
.mobile-nav-btn--sim.active svg { filter: drop-shadow(0 0 6px rgba(249,115,22,0.6)); }

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.4); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .contact-detail-col { display: none !important; }
    .two-col-layout { grid-template-columns: 1fr; }
    .simulator-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .mobile-bottom-nav { display: flex; }

    .app-shell { flex-direction: column; padding-bottom: 62px; }
    .main-area { height: calc(100vh - 62px); }

    .view-page-header { padding: 20px 16px 0; }
    .page-title { font-size: 1.3rem; }

    .chat-list-col { width: 100%; }
    .chat-win-col {
        width: 100%;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 62px;
        background: var(--color-bg);
        display: none;
        z-index: 100;
    }
    .inbox-wrap { position: relative; }
    .inbox-wrap.chat-active .chat-list-col { display: none; }
    .inbox-wrap.chat-active .chat-win-col { display: flex; }
    .back-btn-chat { display: flex !important; }

    .two-col-layout { padding: 16px; }
    .simulator-layout { padding: 16px; }
    .kanban-wrap { padding: 16px; }
    .kanban-col { min-width: 80vw; }
    .form-row-2 { grid-template-columns: 1fr; }
    .glass-card { padding: 18px; }
    .bubble { max-width: 82%; }
}
