:root {
    --bg-dark: #0f111a;
    --sidebar-bg: #161925;
    --card-bg: #1c2030;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --brand-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.logo h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo h2 span {
    color: var(--accent);
    font-weight: 300;
}

.sidebar-nav {
    padding: 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

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

.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.nav-item.active i {
    color: var(--accent);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

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

.user-info strong {
    font-size: 14px;
}

.user-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 10px 16px;
    border-radius: 20px;
    width: 350px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

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

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Views */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

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

.view-header {
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.view-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

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

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

/* Dashboard Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.3);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.metric-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.metric-icon.green { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.metric-icon.purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.metric-icon.orange { background: rgba(249, 115, 22, 0.1); color: #f97316; }

.metric-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-info p {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

.dashboard-bttm {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.activity-list, .task-list {
    list-style: none;
    margin-top: 16px;
}

.activity-item, .task-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child, .task-item:last-child {
    border-bottom: none;
}

.activity-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* Contacts Table */
.table-card {
    padding: 0;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.status-badge.lead { background: rgba(249, 115, 22, 0.1); color: #f97316; }

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.kanban-column {
    flex: 0 0 300px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

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

.column-header h3 {
    font-size: 15px;
}

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

.kanban-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

.kanban-card h4 {
    margin-bottom: 4px;
    font-size: 15px;
}

.kanban-card p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
}

.card-meta.high { color: var(--danger); }
.card-meta.medium { color: var(--warning); }
.card-meta.low { color: var(--success); }

/* Placeholder */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-content i {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.placeholder-content h2 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Form Elements */
.form-select {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--accent);
}

.controls-row {
    display: flex;
    align-items: center;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 480px;
    max-width: 90%;
    padding: 32px;
    box-shadow: var(--shadow-md);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(20px);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* Modal Form */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* --- Authentication Login Screen --- */
.login-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.login-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 48px 40px;
    border-radius: 16px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
    text-align: center;
}

.login-box .logo {
    justify-content: center;
    margin-bottom: 16px;
}

.login-box .logo h2 {
    font-size: 28px;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.login-box form {
    text-align: left;
}

.login-box button {
    margin-top: 16px;
    padding: 14px;
    font-size: 15px;
}

.login-error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-top: 24px;
    font-size: 14px;
    display: none;
}

.login-error.active {
    display: block;
}
