:root {
    /* Color Palette - Scandinavian Minimalist */
    --bg-color: #f8f9fa; /* Very soft off-white background */
    --card-bg: #ffffff;
    --text-main: #1f2937; /* Dark slate */
    --text-muted: #6b7280;
    
    --primary-color: #0f172a; /* Navy blue */
    --primary-light: #e2e8f0;
    --accent-green: #4ade80; /* Sage green for positive */
    --accent-red: #f87171; /* Soft red for alerts */
    
    --border-color: #f3f4f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.02), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 24px 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
}

.logo {
    font-weight: 700;
    font-size: 24px;
    color: var(--primary-color);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
}

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

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.badge {
    margin-left: auto;
    background-color: var(--accent-red);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* User Profile Sidebar */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    margin-top: auto;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.avatar.small {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
}

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

/* Sidebar Toggle Button */
.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* Collapsed State Styles */
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .badge,
.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .brand {
    padding-left: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle {
    margin-left: 0;
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 12px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--primary-color);
}

.notification .dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.metric-card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
}

.metric-card.highlight {
    border-top: 3px solid var(--primary-color);
}

.metric-header {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.metric-trend {
    font-size: 12px;
    font-weight: 500;
}

.metric-trend.positive { color: var(--accent-green); }
.metric-trend.negative { color: var(--accent-red); }
.metric-trend.neutral { color: var(--text-muted); }

.mini-chart {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 80px;
    height: 30px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--primary-light);
    border-radius: 2px;
    margin-top: 12px;
}

.progress-bar .fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Lower Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
}

/* Chat Section */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 500px;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.user .msg-avatar {
    background-color: var(--primary-color);
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-info {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    gap: 8px;
    align-items: center;
}

.msg-info .time {
    font-weight: 400;
    color: var(--text-muted);
}

.message.ai .msg-text {
    background-color: var(--bg-color);
    padding: 14px 18px;
    border-radius: 0 16px 16px 16px;
    font-size: 14px;
    color: var(--text-main);
}

.message.user .msg-text {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 18px;
    border-radius: 16px 0 16px 16px;
    font-size: 14px;
}

.msg-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-color);
}

/* Chat Input */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    border: none;
    background-color: var(--bg-color);
    padding: 14px 20px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.chat-input-area input:focus {
    box-shadow: 0 0 0 2px var(--primary-light);
}

.icon-btn.send {
    background-color: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.icon-btn.send:hover {
    transform: scale(1.05);
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.task-list {
    list-style: none;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.task-icon {
    margin-top: 2px;
    font-size: 20px;
}

.task-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-title {
    font-size: 14px;
    font-weight: 500;
}

.status-progress { background-color: #fef3c7; color: #b45309; }
.status-track { background-color: #dcfce7; color: #166534; }
.status-pending { background-color: #f3f4f6; color: #4b5563; }

.alerts-card {
    flex: 1;
}

.alert-item {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item i {
    font-size: 20px;
    margin-top: 2px;
}

.alert-item.warning i { color: #f59e0b; }
.alert-item.error i { color: var(--accent-red); }

.alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-title {
    font-size: 13px;
    font-weight: 600;
}

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

/* ==========================================================================
   VIEWS CONTAINER & TABS
   ========================================================================== */
.views-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.view-section {
    display: none;
    height: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: block;
}

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

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

/* ==========================================================================
   PORTFOLIO VIEW
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.project-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.project-type {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.project-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.project-wig {
    background-color: var(--bg-body);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
}

.project-wig h4 {
    font-size: 0.8rem;
    color: var(--text-color);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-wig p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.team-avatars {
    display: flex;
    gap: -8px;
}

.team-avatars .avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-hover);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid var(--bg-card);
    margin-left: -8px;
}
.team-avatars .avatar-sm:first-child {
    margin-left: 0;
}

/* ==========================================================================
   LIBRARY VIEW
   ========================================================================== */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.doc-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.doc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.doc-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.doc-info {
    flex: 1;
}

.doc-info h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.doc-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   MODAL (NEW INITIATIVE)
   ========================================================================== */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 24px;
}

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

.modal-header h2 {
    font-size: 1.2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: var(--bg-body);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(132, 169, 140, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
