/* ==========================================================================
   TIFA - TICMI Management & CS Dashboard Style System
   Design: Modern Glassmorphism, Dark Mode, Curated Tech Palette
   ========================================================================== */

:root {
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Color Palette */
    --bg-base: #0a0e17;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-glass: rgba(17, 24, 39, 0.75);
    --bg-glass-hover: rgba(30, 41, 59, 0.85);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-bright: rgba(255, 255, 255, 0.15);

    /* Text Colors */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    /* Accents */
    --primary: #06b6d4;          /* Cyan */
    --primary-glow: rgba(6, 182, 212, 0.35);
    --accent-emerald: #10b981;   /* AI Active */
    --accent-amber: #f59e0b;     /* Escalation Alert */
    --accent-amber-glow: rgba(245, 158, 11, 0.35);
    --accent-purple: #8b5cf6;    /* Human CS */
    --accent-rose: #f43f5e;      /* Danger / Disconnected */

    /* Chat Bubbles */
    --bubble-customer: rgba(30, 41, 59, 0.9);
    --bubble-ai: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(16, 185, 129, 0.15));
    --bubble-cs: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.2));
    --bubble-system: rgba(245, 158, 11, 0.12);

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

    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* App Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.06), transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05), transparent 40%),
                var(--bg-base);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    z-index: 20;
}

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

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

.sparkle {
    animation: rotateSlow 8s linear infinite;
}

@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-brand {
    font-size: 10px;
    background: rgba(6, 182, 212, 0.2);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(6, 182, 212, 0.4);
    letter-spacing: 0.5px;
}

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

.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);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

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

.nav-label {
    flex: 1;
}

.badge-count {
    background: var(--accent-amber);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.status-dot-sm {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-rose);
}
.status-dot-sm.online {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

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

.system-status-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
}

.status-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-rose);
}
.status-indicator-dot.online {
    background: var(--accent-emerald);
    box-shadow: 0 0 6px var(--accent-emerald);
}

/* ==========================================================================
   Main Content & Tabs
   ========================================================================== */
.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.tab-panel {
    display: none;
    height: 100%;
    width: 100%;
}
.tab-panel.active {
    display: flex;
}

.panel-container {
    padding: 32px;
    overflow-y: auto;
    width: 100%;
    height: 100%;
}

.panel-header {
    margin-bottom: 24px;
}
.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}
.panel-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* ==========================================================================
   TAB 1: LIVE CHAT (CS HUMAN TAKEOVER)
   ========================================================================== */
.chat-workspace {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Column 1: Conversations List */
.conv-sidebar {
    width: 360px;
    min-width: 360px;
    background: rgba(13, 19, 33, 0.9);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.conv-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conv-header-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 8px;
}
.search-icon {
    font-size: 14px;
    color: var(--text-dim);
}
.search-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 13px;
    width: 100%;
    outline: none;
}

.filter-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.chip {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.chip:hover {
    background: var(--bg-glass-hover);
    color: var(--text-main);
}
.chip.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: 700;
}
.chip-escalated.active {
    background: var(--accent-amber);
    border-color: var(--accent-amber);
    color: #000;
}

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
}
.conv-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.conv-item.active {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.3);
}

.conv-item.escalated {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
    animation: pulseBorder 2s infinite;
}

@keyframes pulseBorder {
    0%, 100% { border-color: rgba(245, 158, 11, 0.4); }
    50% { border-color: rgba(245, 158, 11, 0.9); box-shadow: 0 0 10px var(--accent-amber-glow); }
}

.conv-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    border: 1px solid var(--border-glass);
}

.conv-info {
    flex: 1;
    min-width: 0;
}
.conv-top-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.conv-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-time {
    font-size: 11px;
    color: var(--text-dim);
}

.conv-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.conv-snippet {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conv-badge-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
    margin-left: 6px;
}
.badge-status-ai {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-status-human {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-status-escalated {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Column 2: Chat Window */
.chat-window {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(10, 14, 23, 0.95);
    position: relative;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}
.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.chat-empty-state h3 {
    font-family: var(--font-heading);
    font-size: 22px;
    margin-bottom: 8px;
}
.chat-empty-state p {
    color: var(--text-muted);
    max-width: 420px;
    font-size: 14px;
}

.chat-active-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 16px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 14px;
}
.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    border: 1px solid var(--border-glass-bright);
}
.contact-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.contact-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
}
.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.contact-phone {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
}

.btn-takeover {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}
.btn-takeover:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.btn-return-ai {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}
.btn-return-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.escalation-alert-banner {
    background: rgba(245, 158, 11, 0.15);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fbbf24;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.banner-icon {
    font-size: 20px;
}
.banner-text {
    flex: 1;
    font-size: 13px;
}
.banner-text strong {
    color: #fff;
}

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

.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    position: relative;
    animation: fadeIn 0.2s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-wrapper.customer {
    align-self: flex-start;
}
.msg-wrapper.ai {
    align-self: flex-end;
}
.msg-wrapper.cs {
    align-self: flex-end;
}
.msg-wrapper.system {
    align-self: center;
    max-width: 85%;
}

.msg-sender-tag {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.msg-wrapper.customer .msg-sender-tag { color: var(--text-muted); }
.msg-wrapper.ai .msg-sender-tag { color: var(--primary); justify-content: flex-end; }
.msg-wrapper.cs .msg-sender-tag { color: var(--accent-purple); justify-content: flex-end; }

.msg-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
    white-space: pre-wrap;
}

.msg-wrapper.customer .msg-bubble {
    background: var(--bubble-customer);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
    border-bottom-left-radius: 4px;
}
.msg-wrapper.ai .msg-bubble {
    background: var(--bubble-ai);
    color: #e0f2fe;
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-bottom-right-radius: 4px;
}
.msg-wrapper.cs .msg-bubble {
    background: var(--bubble-cs);
    color: #f3e8ff;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-bottom-right-radius: 4px;
}
.msg-wrapper.system .msg-bubble {
    background: var(--bubble-system);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: center;
    padding: 8px 16px;
}

.msg-timestamp {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 4px;
}
.msg-wrapper.customer .msg-timestamp { text-align: left; }
.msg-wrapper.ai .msg-timestamp,
.msg-wrapper.cs .msg-timestamp { text-align: right; }

/* Canned Responses */
.canned-responses-bar {
    padding: 8px 24px;
    background: rgba(17, 24, 39, 0.8);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
}
.canned-label {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
}
.canned-chip {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.canned-chip:hover {
    background: var(--bg-glass-hover);
    color: var(--text-main);
    border-color: var(--border-glass-bright);
}

/* Chat Composer */
.chat-composer {
    padding: 16px 24px;
    background: var(--bg-glass);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.chat-composer textarea {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: var(--transition);
}
.chat-composer textarea:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.btn-send {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-purple), #6366f1);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    height: 44px;
}
.btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* ==========================================================================
   TAB 2: SETTINGS & PROMPT
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-glass h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.code-textarea {
    width: 100%;
    background: #080c14;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    outline: none;
    resize: vertical;
}
.code-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}
.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.slider-val {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 700;
}

.input-text, .input-select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.input-text:focus, .input-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-primary {
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-secondary {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.save-status {
    font-size: 13px;
    color: var(--accent-emerald);
    font-weight: 600;
}

/* ==========================================================================
   TAB 3: KNOWLEDGE BASE (FAQS)
   ========================================================================== */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.faq-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}
.faq-card:hover {
    border-color: var(--border-glass-bright);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.faq-category {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.faq-question {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}
.faq-answer {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-line;
    margin-bottom: 14px;
}
.faq-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-glass);
    padding-top: 10px;
}
.btn-delete-faq {
    background: transparent;
    border: none;
    color: var(--accent-rose);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

/* ==========================================================================
   TAB 4: WHATSAPP GATEWAY
   ========================================================================== */
.wa-status-dashboard {
    max-width: 600px;
}

.wa-qr-card {
    text-align: center;
}

.wa-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.badge-pill {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}
.badge-pill.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    border: 1px solid var(--accent-emerald);
}
.badge-pill.offline {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
    border: 1px solid var(--accent-rose);
}

.qr-container {
    width: 280px;
    height: 280px;
    margin: 0 auto 24px;
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.qr-placeholder {
    color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.qr-icon {
    font-size: 48px;
}
.qr-placeholder p {
    font-size: 13px;
    color: #4b5563;
}

#qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wa-instructions {
    text-align: left;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}
.wa-instructions h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--primary);
}
.wa-instructions ol {
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ==========================================================================
   TAB 5: STATS & OVERVIEW
   ========================================================================== */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border-glass);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.stat-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 13px;
    opacity: 0.8;
}

.gradient-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.05));
    border-color: rgba(6, 182, 212, 0.3);
    color: #e0f2fe;
}
.gradient-emerald {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
    border-color: rgba(16, 185, 129, 0.3);
    color: #d1fae5;
}
.gradient-amber {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fef3c7;
}
.gradient-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
    border-color: rgba(139, 92, 246, 0.3);
    color: #f3e8ff;
}

.arch-flow {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}
.arch-box {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}
.arch-box.highlight {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.1);
}
.arch-arrow {
    color: var(--text-dim);
    font-size: 20px;
}
.arch-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}
.arch-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================================================
   Modals & Toast
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s;
}
.modal-content {
    width: 520px;
    max-width: 90vw;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 999;
}
.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .settings-grid { grid-template-columns: 1fr; }
    .stats-cards-grid { grid-template-columns: repeat(2, 1fr); }
    .conv-sidebar { width: 300px; min-width: 300px; }
}
