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

:root {
    /* Dark Theme Variables - Crystal Gemstones & Obsidian */
    --bg-main: #060814;
    --bg-gradient: radial-gradient(circle at 50% 0%, #0d1127 0%, #060814 100%);
    --bg-sidebar: rgba(6, 8, 20, 0.85);
    --bg-header: rgba(6, 8, 20, 0.5);
    --bg-card: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    --bg-card-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
    --bg-modal: #090c1a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(168, 85, 247, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --primary: #c084fc; /* Glowing Amethyst Purple */
    --primary-glow: rgba(192, 132, 252, 0.25);
    --secondary: #f472b6; /* Rose Quartz Pink */
    --secondary-glow: rgba(244, 114, 182, 0.2);
    
    --success: #34d399; /* Emerald Green */
    --warning: #fbbf24; /* Amber Citrine */
    --danger: #f87171; /* Ruby Red */
    --info: #38bdf8; /* Sapphire Blue */
    
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    
    --sidebar-width: 260px;
    --glass-blur: blur(25px);
    --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-card: 0 15px 35px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.light-mode {
    /* Light Theme Variables - Crystal Quartz & Slate */
    --bg-main: #f8fafc;
    --bg-gradient: radial-gradient(circle at 50% 0%, #eef2f6 0%, #f8fafc 100%);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-header: rgba(255, 255, 255, 0.6);
    --bg-card: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.6) 100%);
    --bg-card-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.75) 100%);
    --bg-modal: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-hover: rgba(124, 58, 237, 0.3);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --primary: #7c3aed; /* Amethyst Purple */
    --primary-glow: rgba(124, 58, 237, 0.2);
    --secondary: #db2777; /* Deep Rose Quartz */
    --secondary-glow: rgba(219, 39, 119, 0.15);
    
    --success: #059669; /* Emerald Green */
    --warning: #d97706; /* Amber Citrine */
    --danger: #dc2626; /* Ruby Red */
    --info: #0284c7; /* Sapphire Blue */
    
    --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --shadow-card: 0 15px 35px -10px rgba(79, 70, 229, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* Global Transitions for Theme Mode Toggle */
body, aside, main, header, .stat-card, .chart-card, .remarks-card, .chat-panel, .sources-panel, .search-input, .select-filter, .form-input, .modal, .source-node, td, th, .page-btn, .action-btn, .sidebar-logo, .sidebar-title, .nav-item {
    transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: var(--font-sans);
    background: transparent;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Liquid Background Elements */
.liquid-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-main);
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(129, 140, 248, 0.08) 0%, transparent 60%),
        linear-gradient(to right, rgba(255, 255, 255, 0.007) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.007) 1px, transparent 1px),
        var(--bg-gradient);
    background-size: 100% 100%, 50px 50px, 50px 50px, 100% 100%;
    transition: background 0.5s ease, background-image 0.5s ease;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.4;
    mix-blend-mode: screen;
    animation: drift 25s infinite alternate ease-in-out;
    transition: background 0.5s ease, opacity 0.5s ease;
}

.light-mode .blob {
    mix-blend-mode: multiply;
    opacity: 0.12;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, rgba(0, 240, 255, 0) 70%);
    top: -15%;
    left: -10%;
    animation-duration: 25s;
}

.blob-2 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, var(--secondary) 0%, rgba(168, 85, 247, 0) 70%);
    bottom: -20%;
    right: -10%;
    animation-delay: -7s;
    animation-duration: 32s;
}

.blob-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--info) 0%, rgba(59, 130, 246, 0) 70%);
    top: 35%;
    left: 40%;
    animation-delay: -12s;
    animation-duration: 28s;
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    33% { transform: translate(80px, 60px) rotate(120deg) scale(1.1); }
    66% { transform: translate(-40px, 100px) rotate(240deg) scale(0.95); }
    100% { transform: translate(0, 0) rotate(360deg) scale(1); }
}

/* Theme Toggle Button Styles */
.theme-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sidebar layout */
aside {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2px;
    transition: transform 0.1s ease;
}

.bot-visor {
    width: 28px;
    height: 12px;
    background: #020617;
    border-radius: 6px;
    border: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 2px;
}

.bot-eye {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary), 0 0 2px #fff;
    transition: transform 0.05s linear;
}

.bot-mouth {
    width: 14px;
    height: 2px;
    background: rgba(129, 140, 248, 0.3);
    margin-top: 4px;
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(129, 140, 248, 0.2);
}

/* Cybernetic card bracket corners */
.stat-card::before, .stat-card::after,
.chart-card::before, .chart-card::after,
.remarks-card::before, .remarks-card::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-color: var(--primary);
    border-style: solid;
    opacity: 0;
    transition: var(--transition);
}
.stat-card::before, .chart-card::before, .remarks-card::before {
    top: 8px; left: 8px;
    border-width: 1px 0 0 1px;
}
.stat-card::after, .chart-card::after, .remarks-card::after {
    bottom: 8px; right: 8px;
    border-width: 0 1px 1px 0;
}
.stat-card:hover::before, .stat-card:hover::after,
.chart-card:hover::before, .chart-card:hover::after,
.remarks-card:hover::before, .remarks-card:hover::after {
    opacity: 0.8;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--text-primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--primary);
    box-shadow: inset 5px 0 10px rgba(0, 240, 255, 0.05);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

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

/* Main Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur);
}

.header-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
}

.api-badge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.api-badge.configured {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.api-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Views Wrapper */
.view-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2rem;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease;
    height: 100%;
}

.view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#view-dashboard, #view-settings, #view-diagnostics, #view-telemetry, #view-voice-clone, #view-courses, #view-leads {
    overflow-y: auto;
    padding-right: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard View Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--card-color, var(--primary));
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-main);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    margin: 0.25rem 0;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Analytics Row */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* CSS Charts */
.chart-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0.5rem 0;
}

.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar-track {
    width: 32px;
    height: 180px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.bar-fill {
    width: 100%;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 16px;
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

.bar-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Pie List Chart Fallback */
.pie-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    justify-content: center;
    flex: 1;
}

.pie-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pie-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pie-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.pie-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pie-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin: 0 1.5rem;
    overflow: hidden;
}

.pie-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.pie-val {
    font-size: 0.85rem;
    font-weight: 600;
    width: 50px;
    text-align: right;
}

/* Recent Remarks Container */
.remarks-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.remarks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.remark-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--info);
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: var(--transition);
}

.remark-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.remark-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.remark-student {
    font-weight: 600;
    color: var(--text-primary);
}

.remark-stage {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

.remark-text {
    color: var(--text-secondary);
    font-style: italic;
}

/* AI Chat RAG View */
.chat-view-layout {
    display: flex;
    flex: 1;
    height: 100%;
    gap: 1.5rem;
}

.chat-panel {
    flex: 2;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chat-msg {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    animation: messageSlide 0.3s ease;
}

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

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg.assistant {
    align-self: flex-start;
}

.msg-bubble {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.chat-msg.user .msg-bubble {
    background: linear-gradient(135deg, var(--secondary), #7c3aed);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.chat-msg.assistant .msg-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.msg-bubble p {
    margin-bottom: 0.75rem;
}
.msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-bubble ul, .msg-bubble ol {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
}
.msg-bubble li {
    margin-bottom: 0.35rem;
}

.msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chat-msg.user .msg-meta {
    align-self: flex-end;
}

.chat-msg.assistant .msg-meta {
    align-self: flex-start;
}

.chat-input-area {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    background: rgba(5, 7, 12, 0.4);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-input-row {
    display: flex;
    gap: 0.75rem;
}

.chat-textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    resize: none;
    height: 48px;
    transition: var(--transition);
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    background: rgba(255, 255, 255, 0.04);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition);
}

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

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.chat-status-bar {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sources-panel {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.sources-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
}

.sources-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.source-node {
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.source-node-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.source-node-type {
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.source-node-title {
    color: var(--text-primary);
}

.source-node-snippet {
    color: var(--text-secondary);
    font-style: italic;
}

/* Empty State */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    gap: 1rem;
    padding: 2rem;
}

.chat-empty svg {
    width: 64px;
    height: 64px;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    margin-bottom: 0.5rem;
}

.chat-empty-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--text-secondary);
}

.chat-empty-p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* Tables and Directories */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
}

.filter-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.select-filter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.select-filter:focus {
    border-color: var(--primary);
}

.select-filter option {
    background: var(--bg-main);
    color: var(--text-primary);
}

.action-btn {
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: #000;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.5;
}

/* Glass table */
.table-wrapper {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-main);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.25rem;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-wrap {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    max-width: 450px !important;
    min-width: 250px !important;
    line-height: 1.4;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Status pills */
.pill {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.pill.hot {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill.warm {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill.cold, .pill.attempt {
    background: rgba(14, 165, 233, 0.15);
    color: var(--info);
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.pill.dead {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pagination-btn-group {
    display: flex;
    gap: 0.5rem;
}

.page-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.course-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
}

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-main);
}

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

.course-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.course-card-fee {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 240, 255, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    font-weight: 600;
}

.course-card-duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.course-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex: 1;
}

.course-card-syllabus {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    font-size: 0.8rem;
}

.course-syllabus-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.course-syllabus-item {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Ingestion & Settings Panel */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* File Upload drag area */
.file-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition);
}

.file-drop-area:hover, .file-drop-area.dragover {
    border-color: var(--primary);
    background: rgba(0, 240, 255, 0.03);
}

.file-drop-area svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    stroke-width: 1.5;
}

.file-drop-title {
    font-weight: 600;
    color: var(--text-secondary);
}

.file-drop-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-input {
    display: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1100;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 2rem 1rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Typography components */
.text-gradient {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Typing Indicator Animation */
.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding-left: 5px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive Rules */
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }
    
    aside {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
    }
    
    .sidebar-brand {
        padding: 1rem 0;
    }
    
    .sidebar-nav {
        flex-direction: row;
        gap: 0.25rem;
        padding: 0;
    }
    
    .nav-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .nav-item span {
        display: none;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    main {
        height: calc(100vh - 65px);
    }
    
    .chat-view-layout {
        flex-direction: column;
        height: 100%;
    }
    
    .sources-panel {
        max-height: 200px;
    }
}

/* --- VoIP Dialer Widget Overlay CSS --- */
.dialer-overlay {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 380px;
    z-index: 1000;
    animation: slideInDialer 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInDialer {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialer-window {
    background: var(--bg-modal);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color-hover);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.dialer-pulse {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: blinkDialer 1.5s infinite ease-in-out;
}

@keyframes blinkDialer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.dialer-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dialer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px var(--primary-glow), inset 0 0 10px var(--primary-glow);
    padding: 2px;
    background: var(--bg-modal);
    animation: vibrateAvatar 3s infinite ease-in-out;
}

@keyframes vibrateAvatar {
    0%, 100% { transform: scale(1); }
    10%, 20% { transform: scale(1.05) rotate(-3deg); }
    30%, 50%, 70% { transform: scale(1.05) rotate(3deg); }
    40%, 60%, 80% { transform: scale(1.05) rotate(-3deg); }
    90% { transform: scale(1); }
}

.dialer-student-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dialer-student-phone {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.dialer-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.dialer-transcript {
    width: 100%;
    height: 260px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.4;
}

.dialer-msg {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    animation: slideMsg 0.3s ease;
}

@keyframes slideMsg {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dialer-msg.advisor {
    align-items: flex-end;
}

.dialer-msg.student {
    align-items: flex-start;
}

.dialer-bubble {
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    max-width: 85%;
}

.dialer-msg.advisor .dialer-bubble {
    background: rgba(0, 240, 255, 0.15);
    color: var(--primary);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-bottom-right-radius: 3px;
}

.dialer-msg.student .dialer-bubble {
    background: rgba(168, 85, 247, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-bottom-left-radius: 3px;
}

.dialer-msg.system .dialer-bubble {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-style: italic;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    align-self: center;
    border-radius: 8px;
}

.dialer-msg.system.vad-log .dialer-bubble {
    background: rgba(14, 165, 233, 0.06);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.15);
    font-weight: 500;
}

.dialer-msg.system.backchannel-log .dialer-bubble {
    background: rgba(234, 179, 8, 0.06);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.15);
    font-weight: 500;
}

.dialer-speaker-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.dialer-footer {
    display: flex;
    justify-content: center;
}

.dialer-btn {
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.dialer-btn.hangup {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.dialer-btn.hangup:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

/* Campaign Log Color Coding */
.camp-log-line {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    border-left: 3px solid transparent;
}
.camp-log-line.info {
    border-left-color: var(--info);
    color: var(--text-primary);
}
.camp-log-line.success {
    border-left-color: var(--success);
    color: var(--success);
    font-weight: 500;
}
.camp-log-line.warning {
    border-left-color: var(--warning);
    color: var(--warning);
}
.camp-log-line.danger {
    border-left-color: var(--danger);
    color: var(--danger);
    font-weight: 500;
}
.camp-log-line.muted {
    border-left-color: var(--text-muted);
    color: var(--text-muted);
}

/* Dialer Input Area Styles */
.dialer-input-area {
    width: 100%;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.dialer-input-area input {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
}

.dialer-input-area input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.dialer-input-area button {
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.dialer-input-area button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Custom Premium Minimalist Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}
.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
}
.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* Classy Robotic Banner */
.robotic-banner {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: visible;
    box-shadow: var(--shadow-card);
    gap: 1.5rem;
}

.robotic-banner::before, .robotic-banner::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--primary);
    border-style: solid;
    opacity: 0.8;
}
.robotic-banner::before { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.robotic-banner::after { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }

.banner-text h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.banner-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 680px;
    line-height: 1.5;
}

.interactive-robot-container {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 400px;
    flex-shrink: 0;
}

.large-robot {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #1e293b 0%, #0f172a 100%);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--primary-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.large-robot .robot-visor {
    width: 60px;
    height: 22px;
    background: #020617;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 6px;
    margin-bottom: 6px;
}

.large-robot .robot-eye {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--primary), 0 0 3px #fff;
    transition: transform 0.05s linear;
}

.large-robot .robot-mouth {
    width: 24px;
    height: 4px;
    background: rgba(129, 140, 248, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.large-robot .mouth-wave {
    width: 100%;
    height: 100%;
    background: var(--primary);
    animation: robotVoice 1.5s infinite alternate ease-in-out;
}

@keyframes robotVoice {
    0% { transform: scaleX(0.3); opacity: 0.5; }
    100% { transform: scaleX(1); opacity: 1; }
}

.large-robot .robot-ears {
    position: absolute;
    width: 90px;
    height: 16px;
    background: var(--primary-glow);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: -1;
    top: 32px;
}

.large-robot .robot-neck {
    width: 20px;
    height: 12px;
    background: #334155;
    border-radius: 4px;
    position: absolute;
    bottom: -10px;
    z-index: -2;
}

/* Crystal Shimmer Reflection swoosh */
.page-btn, .action-btn, .theme-toggle, .nav-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.page-btn > *, .action-btn > *, .theme-toggle > *, .nav-item > * {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.page-btn::before, .action-btn::before, .theme-toggle::before, .nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: skewX(-25deg);
    transition: none;
    pointer-events: none !important;
    z-index: 1;
}

.page-btn:hover::before, .action-btn:hover::before, .theme-toggle:hover::before, .nav-item:hover::before {
    left: 150%;
    transition: left 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Crystal cut-glass card border highlights */
.stat-card, .chart-card, .remarks-card {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08), var(--shadow-card);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover, .chart-card:hover, .remarks-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15), 0 10px 25px var(--primary-glow), var(--shadow-card);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}
