/* CRM Onboarding System v3.3 - Styles */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--gray-900); color: white; display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: transform .3s; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--gray-700); }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--primary-light); }
.sidebar-header small { color: var(--gray-400); font-size: .75rem; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; padding: 12px 20px; color: var(--gray-300); cursor: pointer; transition: all .2s; border-left: 3px solid transparent; gap: 12px; font-size: .9rem; }
.nav-item:hover { background: var(--gray-800); color: white; }
.nav-item.active { background: rgba(79,70,229,.15); color: var(--primary-light); border-left-color: var(--primary-light); }
.nav-item .badge { background: var(--danger); color: white; font-size: .7rem; padding: 2px 8px; border-radius: 10px; margin-left: auto; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--gray-700); }
.sidebar-footer .user-info { font-size: .85rem; color: var(--gray-400); margin-bottom: 8px; }
.sidebar-footer .user-info strong { color: white; display: block; }
.btn-logout { width: 100%; padding: 8px; border: 1px solid var(--gray-600); background: transparent; color: var(--gray-300); border-radius: 8px; cursor: pointer; transition: all .2s; }
.btn-logout:hover { background: var(--danger); border-color: var(--danger); color: white; }

.main-content { flex: 1; margin-left: 260px; padding: 24px; max-width: calc(100% - 260px); }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.page-header p { color: var(--gray-500); font-size: .9rem; }

/* Cards */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .9; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-icon { padding: 6px; border-radius: 6px; background: transparent; border: none; cursor: pointer; color: var(--gray-500); }
.btn-icon:hover { background: var(--gray-100); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: .9rem; transition: border-color .2s; background: white; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--gray-200); font-size: .875rem; }
th { background: var(--gray-50); font-weight: 600; color: var(--gray-600); white-space: nowrap; }
tr:hover { background: var(--gray-50); }

/* Stage Pipeline */
.stage-pipeline { display: flex; gap: 4px; margin: 20px 0; flex-wrap: wrap; }
.stage-pill { flex: 1; min-width: 100px; text-align: center; padding: 10px 8px; border-radius: 8px; font-size: .8rem; font-weight: 600; background: var(--gray-100); color: var(--gray-400); position: relative; transition: all .3s; }
.stage-pill.completed { background: #D1FAE5; color: #065F46; }
.stage-pill.current { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(79,70,229,.3); }
.stage-pill.active-next { background: #FEF3C7; color: #92400E; border: 2px dashed var(--warning); }
.stage-pill.locked { background: var(--gray-100); color: var(--gray-400); }

/* Stage Badges */
.stage-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.stage-prospect { background: #DBEAFE; color: #1E40AF; }
.stage-interaction { background: #E0E7FF; color: #3730A3; }
.stage-proposal { background: #FEF3C7; color: #92400E; }
.stage-loi { background: #FDE68A; color: #78350F; }
.stage-mou { background: #D1FAE5; color: #065F46; }
.stage-boarded { background: #10B981; color: white; }

/* Status Badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.status-pending { background: #FEF3C7; color: #92400E; }
.status-approved { background: #D1FAE5; color: #065F46; }
.status-rejected { background: #FEE2E2; color: #991B1B; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; gap: 0; overflow-x: auto; }
.tab { padding: 10px 20px; cursor: pointer; font-size: .875rem; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab.locked { color: var(--gray-300); cursor: not-allowed; }
.tab.locked:hover { color: var(--gray-300); }
.tab .lock-icon { font-size: .7rem; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Dashboard Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-label { font-size: .85rem; color: var(--gray-500); margin-top: 4px; }
.stat-card .stat-icon { font-size: 1.5rem; float: right; opacity: .4; }

/* Info Box */
.info-box { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; font-size: .875rem; display: flex; align-items: flex-start; gap: 10px; }
.info-box.info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.info-box.success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.info-box.warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.info-box.danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.info-box .info-icon { font-size: 1.1rem; flex-shrink: 0; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: white; border-radius: var(--radius); width: 100%; max-width: 550px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400); padding: 0 4px; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* Login */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 8px; color: var(--gray-900); }
.login-card .subtitle { text-align: center; color: var(--gray-500); font-size: .9rem; margin-bottom: 32px; }
.login-card .btn-primary { width: 100%; padding: 12px; font-size: 1rem; }

/* Activity Timeline */
.timeline { list-style: none; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: .85rem; }
.timeline-item .time { color: var(--gray-400); white-space: nowrap; min-width: 120px; }
.timeline-item .action { font-weight: 500; }

/* Upload Area */
.upload-area { border: 2px dashed var(--gray-300); border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: all .2s; }
.upload-area:hover { border-color: var(--primary); background: rgba(79,70,229,.02); }
.upload-area.dragover { border-color: var(--primary); background: rgba(79,70,229,.05); }
.upload-area input[type="file"] { display: none; }
.upload-area .upload-icon { font-size: 2rem; color: var(--gray-400); }
.upload-area p { color: var(--gray-500); font-size: .9rem; margin-top: 8px; }
.file-selected { margin-top: 8px; font-size: .85rem; color: var(--success); font-weight: 500; }

/* Mobile */
.mobile-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--primary); color: white; border: none; border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 1.2rem; }
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; max-width: 100%; padding: 16px; padding-top: 60px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stage-pipeline { flex-direction: column; }
    .stage-pill { min-width: unset; }
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: .8rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
