:root {
    /* Financial/Corporate Tone Colors */
    --brand-navy: #0f172a;      /* Deep Slate/Navy */
    --brand-blue: #1d4ed8;      /* Royal Blue */
    --brand-blue-hover: #1e40af;
    --bg-main: #f3f4f6;         /* Light Gray Background */
    --card-bg: #ffffff;
    
    /* Semantic Colors */
    --text-dark: #111827;
    --text-main: #374151;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --filter-bg: #f8fafc;
    --filter-border: #e2e8f0;
    
    --success: #16a34a; /* Green */
    --warning: #ca8a04; /* Amber */
    --danger: #dc2626;  /* Red */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

/* --- TOP NAVBAR --- */
.top-navbar {
    background-color: var(--brand-navy);
    color: #ffffff;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}
.logo i { color: #60a5fa; font-size: 1.5rem; }

.nav-menu {
    display: flex;
    list-style: none;
    height: 100%;
    margin: 0 32px;
}

.nav-menu .nav-item {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-menu a {
    color: #9ca3af;
    text-decoration: none;
    font-weight: 500;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-menu a:hover {
    color: #ffffff;
}

.nav-menu .nav-item.active a {
    color: #ffffff;
    border-bottom-color: #3b82f6;
}

/* Right Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 6px 12px;
    width: 250px;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}
.search-box i { color: #9ca3af; margin-right: 8px; }
.search-box input {
    background: transparent; border: none; outline: none; color: #fff; width: 100%; font-size: 0.85rem;
}
.search-box input::placeholder { color: #9ca3af; }

.icon-btn {
    background: transparent; border: none; color: #9ca3af; font-size: 1.2rem; cursor: pointer; transition: color 0.2s;
}
.icon-btn:hover { color: #fff; }

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.user-dropdown img { width: 32px; height: 32px; border-radius: 50%; }
.user-info { display: flex; flex-direction: column; }
.user-info strong { font-size: 0.85rem; color: #fff; }
.user-info span { font-size: 0.75rem; color: #9ca3af; }

/* --- MAIN WRAPPER --- */
.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header & Filters */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.header-title p { color: var(--text-muted); font-size: 0.9rem; }

.header-filters {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.filter-group label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.form-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #fff;
    color: var(--text-dark);
    font-size: 0.85rem;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3e%3cpath fill='none' d='M0 0h24v24H0z'/%3e%3cpath d='M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z' fill='rgba(107,114,128,1)'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-hover); }
.btn-outline { background: #fff; border-color: var(--border-color); color: var(--text-dark); }
.btn-outline:hover { background: #f9fafb; }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.kpi-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;}
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; }
.kpi-meta { font-size: 0.8rem; display: flex; align-items: center; gap: 4px; font-weight: 500;}
.kpi-meta span { color: var(--text-muted); font-weight: 400; }

.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-blue { color: var(--brand-blue); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }

/* Charts Layout */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    height: auto;
}

.panel-heading {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-heading h3 { font-size: 1rem; font-weight: 600; color: var(--text-dark); margin: 0; }

.panel-body { 
    padding: 20px; 
    min-height: 320px; 
    position: relative; 
    height: auto;
    overflow: visible; /* Avoid clipping contents */
}

/* Table Section */
.mt-4 { margin-top: 24px; }
.table-actions { display: flex; gap: 12px; }
.search-input {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
    width: 200px;
}

.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 20px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.85rem;
    color: var(--text-main);
    vertical-align: middle;
}

.avatar-text { display: flex; align-items: center; gap: 10px; font-weight: 500;}
.avatar-text img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.success { background: #dcfce7; color: #16a34a; border: 1px solid #a7f3d0;}
.badge.warning { background: #fef9c3; color: #ca8a04; border: 1px solid #fde68a;}
.badge.danger { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca;}

/* Pagination Styles */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}
.page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
}
.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.page-item .page-link:hover {
    background: #f9fafb;
    color: var(--brand-blue);
    border-color: var(--brand-blue);
}
.page-item.active .page-link {
    background: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
}
.page-item.disabled .page-link {
    background: #f3f4f6;
    color: #cbd5e1;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

/* AI Chat Widget */
.ai-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-blue), #8b5cf6);
    color: #fff;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.4);
    z-index: 100;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Modifiers for different pages */
.ai-chat-toggle.dashboard { background: linear-gradient(135deg, #1d4ed8, #3b82f6); box-shadow: 0 4px 15px rgba(29, 78, 216, 0.4); }
.ai-chat-toggle.sales { background: linear-gradient(135deg, #f97316, #ea580c); box-shadow: 0 4px 15px rgba(234, 88, 12, 0.4); }
.ai-chat-toggle.social { background: linear-gradient(135deg, #8b5cf6, #d946ef); box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); }
.ai-chat-toggle.finance { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4); }

.ai-chat-toggle:hover {
    transform: scale(1.05);
}
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #8b5cf6;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.ai-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}
.ai-chat-header {
    background: var(--brand-navy);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-chat-window.dashboard-window .ai-chat-header { background: #1d4ed8; }
.ai-chat-window.sales-window .ai-chat-header { background: #ea580c; }
.ai-chat-window.social-window .ai-chat-header { background: #8b5cf6; }
.ai-chat-window.finance-window .ai-chat-header { background: #059669; }

.ai-chat-header h4 { margin:0; font-size: 1rem; display: flex; align-items: center; gap: 8px; margin-bottom: 2px;}
.ai-chat-header span { font-size: 0.75rem; color: #9ca3af; }
.ai-chat-header .close-btn { background: transparent; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

.ai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-message {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 85%;
}
.chat-message.ai {
    background: #fff;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-top-left-radius: 0;
}
.chat-message.user {
    background: var(--brand-blue);
    color: #fff;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.ai-chat-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}
.ai-chat-footer input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
}
.ai-chat-footer input:focus { border-color: var(--brand-blue); }
.ai-chat-footer .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Global Filter Bar (Project Context) */
.filter-bar {
    background: #ffffff;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 32px; /* Tăng khoảng cách giữa các nhóm nhãn lọc */
    position: sticky;
    top: 64px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.filter-controls { display: flex; align-items: center; gap: 16px; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label-small { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); }
.filter-separator { width: 1px; height: 16px; background: #e2e8f0; margin: 0 8px; }

.filter-select {
    padding: 6px 12px;
    padding-right: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-blue);
    cursor: pointer;
    min-width: 220px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3e%3cpath fill='none' d='M0 0h24v24H0z'/%3e%3cpath d='M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z' fill='rgba(29, 78, 216, 1)'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--brand-blue);
}

.filter-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}
.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

/* --- PROJECT PAGE STYLES --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.05);
}

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

.p-title-area .p-code {
    font-size: 0.75rem;
    color: var(--brand-blue);
    font-weight: 700;
    margin-bottom: 4px;
}
.p-title-area h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 700;
}

.project-stats-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.s-box {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.s-box i { font-size: 1.5rem; }
.s-info { display: flex; flex-direction: column; }
.s-info span { font-size: 0.75rem; color: var(--text-muted); }
.s-info strong { font-size: 0.9rem; color: var(--text-dark); }

.project-kpi-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fdfdfd;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}
.kpi-label { display: flex; justify-content: space-between; font-size: 0.85rem;}
.kpi-label span { color: var(--text-muted); }
.kpi-label strong { color: var(--text-dark); }

.progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}
.kpi-subtext { font-size: 0.75rem; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.kpi-subtext i { font-size: 1rem; }
.text-warning { color: var(--warning); }

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.avatar-group {
    display: flex;
    align-items: center;
}
.avatar-group img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-left: -10px;
    object-fit: cover;
}
.avatar-group img:first-child { margin-left: 0; }
.avatar-more {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #fff;
    margin-left: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-main);
    z-index: 10;
}
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }

/* --- PROJECT DETAILS PAGE --- */
.project-details-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    margin-top: 24px;
}
.sidebar-menu {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: max-content;
}
.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.menu-link i { font-size: 1.2rem; color: var(--text-muted); }
.menu-link:hover, .menu-link.active {
    background: #eff6ff;
    color: var(--brand-blue);
}
.menu-link.active i { color: var(--brand-blue); }

.content-panel-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.content-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}
.mb-4 { margin-bottom: 24px; }
.ml-2 { margin-left: 8px; }
.mt-2 { margin-top: 8px; }

.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-title span { display: flex; align-items: center; gap: 8px; }

.btn-ai {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #fff;
    border: none;
}
.btn-ai:hover { opacity: 0.9; box-shadow: 0 4px 10px rgba(168,85,247,0.3); }
.text-purple { color: #a855f7; }

/* Asset Grid & Cards */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.asset-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.asset-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}
.asset-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.asset-info {
    padding: 12px;
}
.asset-info h4 { font-size: 0.9rem; margin-bottom: 4px; color: var(--text-dark); line-height: 1.3;}
.asset-info p { font-size: 0.75rem; color: var(--text-muted); }

.ai-create-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    min-height: 220px;
    text-align: center;
    padding: 20px;
}
.border-dashed { border-style: dashed !important; }
.ai-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.ai-box span { font-size: 0.8rem; color: var(--text-muted); }

/* File List Manager */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    transition: background 0.2s;
}
.file-item:hover {
    background: #f8fafc;
}
.file-item-left { display: flex; align-items: center; gap: 16px; }
.file-item-left i { font-size: 1.8rem; }
