t/* ============================================= */
/*          MINI CRM – MASTER STYLESHEET         */
/* ============================================= */

* { margin:0; padding:0; box-sizing:border-box; }
html, body { height: 100%; }
body {
    font-family: 'Inter', sans-serif;
    background: #0f172a;
    color: #8b5cf6;
    min-height: 100vh;
}

/* ============================================= */
/*                1. LOGIN PAGE ONLY             */
/* ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 20%);
}

.login-container {
    background: #1e293b;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.logo { text-align: center; margin-bottom: 30px; }
.logo h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.logo p { color: #94a3b8; font-size: 14px; }

.form-group { margin-bottom: 20px; width:100%;}
label { display: block; margin-bottom: 8px; color: #cbd5e1; font-weight: 500; }

input {
    width: 90%;
    padding: 14px 16px;
    /*background: #0f172a;*/
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 16px;
    transition: all 0.3s;
}
input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 14px;
}

.test-accounts {
    margin-top: 30px;
    padding: 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    font-size: 13px;
    color: #94a3b8;
}
.test-accounts b { color: #e2e8f0; }

/* ============================================= */
/*                2. DASHBOARD & APP             */
/* ============================================= */

/* Make sure body is flex column */
.dashboard-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    color: #8b5cf6;
}

/* Top Bar */
.topbar {
    background: #1e293b;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar .logo h2 {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: white;
}
.role-badge {
    background: rgba(99, 102, 241, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.logout-btn {
    background: #ef4444;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}
.logout-btn:hover { background: #dc2626; }

/* The container (sidebar + main) takes remaining height */
.container {
    display: flex;
    flex: 1;                    /* This is the key! */
    min-height: 0;              /* Allows children to shrink if needed */
}

/* Sidebar: full height from top to bottom */
.sidebar {
    width: 260px;
    background: #1e293b;
    padding: 30px 20px;
    border-right: 1px solid #334155;
    height: 100%;               /* Full height */
    overflow-y: auto;           /* Scroll if too many menu items */
    position: sticky;
    top: 0;
}
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-item {
    padding: 14px 18px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: #c4b5fd;
}
.nav-item.active {
    background: #6366f1;
    color: white;
}

/* Main content: takes all remaining space to the right */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
     background: #dddddd;
    /*background: #0f172a;*?
   /* margin-left: 265px; /* To avoid being under the sidebar */
    /*margin-top: -950px;*/
}
.main-content h1 {
    font-size: 28px;
    margin-bottom: 8px;
}
/* ============================================= */
/*              DASHBOARD REFINED                */
/* ============================================= */

.page-header {
    margin-bottom: 30px;
}
.page-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
}
.subtitle {
    color: #6366f1;
    font-size: 16px;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}
.stat-card {
    background: #1e293b;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #334155;
    transition: transform 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.stat-card h3 {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .number {
    font-size: 36px;
    font-weight: 700;
    margin: 8px 0;
    color: #e2e8f0;
}
.stat-card small {
    color: #64748b;
    font-size: 13px;
}

/* Welcome / Role Card */
.welcome-card {
    background: #1e293b;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid #334155;
    max-width: 800px;
}
.welcome-card h2 {
    margin: 0 0 16px;
    font-size: 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.welcome-card p {
    color: #cbd5e1;
    font-size: 16px;
    margin: 0 0 24px;
}
.welcome-card .actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.welcome-card.admin   { border-left: 5px solid #6366f1; }
.welcome-card.sales   { border-left: 5px solid #facc15; }
.welcome-card.manager { border-left: 5px solid #22d3ee; }



/* Role Sections */
.role-section {
    padding: 30px;
    border-radius: 14px;
    margin-top: 30px;
}
.role-section h2 {
    margin-bottom: 12px;
    font-size: 22px;
}
.role-section.admin   { background: rgba(99, 102, 241, 0.15); border-left: 5px solid #6366f1; }
.role-section.sales   { background: rgba(250, 204, 21, 0.1); border-left: 5px solid #facc15; }
.role-section.manager { background: rgba(34, 211, 238, 0.1); border-left: 5px solid #22d3ee; }

.btn-primary {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}
/* ============================================= */
/*                  LEADS MODULE                 */
/* ============================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.page-header a { color: #19222f; text-decoration: none; }

.table-container {
    background: #1e293b;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #334155;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: #334155;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #cbd5e1;
}
.data-table td {
    padding: 16px;
    border-bottom: 1px solid #334155;
    background: white;
}
.data-table tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status.new { background: #3b82f6; color: white; }
.status.contacted { background: #8b5cf6; color: white; }
.status.qualified { background: #10b981; color: white; }
.status.lost { background: #ef4444; color: white; }

.btn-small {
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.6);
    color: #3109cb;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}
.btn-small.assign { background: #f59e0b; color: white; }

.form-container {
    max-width: 600px;
    background: #1e293b;
    padding: 30px;
    border-radius: 14px;
    border: 1px solid #334155;
}
/* ============================================= */
/*              LEAD ASSIGNMENT PAGE             */
/* ============================================= */

.assign-card {
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid #334155;
    max-width: 680px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.assign-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 24px 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.assign-header h2 {
    font-size: 26px;
    margin: 0;
    font-weight: 700;
}

.lead-info {
    padding: 30px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}
.lead-info p {
    margin: 12px 0;
    font-size: 15px;
}
.lead-info strong {
    color: #cbd5e1;
    width: 140px;
    display: inline-block;
}

.assign-form {
    padding: 30px;
    background: #0f172a;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-secondary {
    display: inline-block;
    padding: 12px 28px;
    background: #334155;
    color: #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}
.btn-secondary:hover {
    background: #475569;
}

/* Flash message */
.flash {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: 500;
    max-width: 680px;
}
.flash.success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
/* ============================================= */
/*                LEAD VIEW PAGE                 */
/* ============================================= */

.lead-view-card {
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid #334155;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.lead-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 28px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.lead-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}
.lead-meta {
    margin: 8px 0 0;
    opacity: 0.9;
    font-size: 14px;
}

.status-select {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    min-width: 140px;
}
.status-select.new       { background: #3b82f6; }
.status-select.contacted { background: #8b5cf6; }
.status-select.qualified { background: #10b981; }
.status-select.lost      { background: #ef4444; }

.lead-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #0f172a;
}
.info-item strong {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.info-item p {
    font-size: 17px;
    margin: 0;
    color: #e2e8f0;
}

.lead-actions {
    padding: 0 30px 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.section {
    padding: 30px;
    border-top: 1px solid #334155;
}
.section h3 {
    margin: 0 0 15px;
    color: #cbd5e1;
}
/* ============================================= */
/*                  TASKS MODULE                  */
/* ============================================= */

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.task-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #334155;
    overflow: hidden;
    transition: all 0.3s;
}
.task-card:hover { transform: 0 8px 25px rgba(0,0,0,0.4); }

.task-header {
    padding: 18px 20px;
    background: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.task-header h3 {
    margin: 0;
    font-size: 17px;
    color: #e2e8f0;
}
.task-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.task-status.pending       { background: #f59e0b; color: #000; }
.task-status.in_progress   { background: #3b82f6; color: white; }
.task-status.completed     { background: #10b981; color: white; }

.task-body {
    padding: 20px;
    line-height: 1.6;
}
.task-body p { margin: 8px 0; }
.description { margin-top: 12px; color: #94a3b8; font-size: 14px; }

.task-footer {
    padding: 10px 15px;
    text-align: right;
    font-size: 13px;
    color: #050608;
}

.overdue { color: #ef4444 !important; font-weight: 600; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

/* Create Task Form */
.form-card {
    max-width: 700px;
    background: #1e293b;
    padding: 35px;
    border-radius: 16px;
    border: 1px solid #334155;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}
textarea, select {
    width: 90%;
    padding: 14px;
   /* background: #0f172a;*/
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    font-family: inherit;
}
textarea:focus, select:focus {
    outline: none;
    border-color: #6366f1;
}
/* ============================================= */
/*           TASKS INSIDE LEAD VIEW              */
/* ============================================= */

.tasks-section {
    margin-top: 40px;
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid #334155;
    overflow: hidden;
}

.section-header {
    background: #334155;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
}
.section-header h3 {
    margin: 0;
    font-size: 18px;
    color: #e2e8f0;
}
.section-header .btn-small {
    background: #6366f1;
    color: white;
    padding: 8px 14px;
    font-size: 13px;
}

.tasks-list {
    padding: 20px 0;
}
.task-item {
    padding: 18px 24px;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    transition: background 0.2s;
}
.task-item:hover {
    background: rgba(99, 102, 241, 0.08);
}
.task-item:last-child {
    border-bottom: none;
}

.task-main h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #e2e8f0;
}
.task-desc {
    margin: 0;
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    text-align: right;
}
.task-status {
    padding: 4px 10px;
    border-radius: 16px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}
.task-status.pending       { background: #f59e0b; color: #000; }
.task-status.in_progress   { background: #3b82f6; color: white; }
.task-status.completed     { background: #10b981; color: white; }

.task-due {
    color: #cbd5e1;
}
.task-due.overdue {
    color: #ef4444 !important;
    font-weight: 600;
}
.task-assigned {
    color: #94a3b8;
}
/* ============================================= */
/*              ADMIN → MANAGE USERS             */
/* ============================================= */

.current-user {
    background: rgba(99, 102, 241, 0.1) !important;
}

.role-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 13px;
    min-width: 120px;
}
.role-select.Admin      { background: #6366f1; color: white; }
.role-select['Sales Rep'] { background: #f59e0b; color: white; }
.role-select.Manager    { background: #22d3ee; color: white; }

.btn-small.delete {
    background: #ef4444;
    color: white;
}
.btn-small.delete:hover {
    background: #dc2626;
}

.flash.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 40px 0;
}
@media (max-width: 992px) {
    .reports-grid { grid-template-columns: 1fr; }
}
.chart-card {
    background: #1e293b;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #334155;
}
.chart-card h3 {
    margin: 0 0 20px;
    color: #e2e8f0;
}@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr;}
    .login-container {
    padding: 10px 10px;
    width: 100%;
    max-width: 450px;
}
@media (max-width: 664px) {
    .form-row { grid-template-columns: 1fr; }
    .login-container {
    width: 100%;
    max-width: 400px;
}
}