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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

.flex { display: flex; }
.h-screen { height: 100vh; }
.bg-gray-50 { background-color: #f9fafb; }
.text-blue { color: #2563eb; }

/* Sidebar Styles */
.sidebar {
    background-color: #111827;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    width: 80px;
}

.sidebar-open {
    width: 256px;
}

.sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #374151;
}

.sidebar-title {
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    display: none;
}

.sidebar-open .sidebar-title {
    display: block;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.sidebar-toggle:hover {
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: none;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    position: relative;
}

.nav-item:hover {
    background-color: #1f2937;
}

.nav-item.active {
    background-color: #2563eb;
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
    text-align: left;
    font-weight: 500;
    display: none;
    white-space: nowrap;
}

.sidebar-open .nav-label {
    display: block;
}

.nav-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    display: none;
    font-weight: 600;
}

.sidebar-open .nav-badge {
    display: block;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #374151;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    display: none;
}

.sidebar-open .user-info {
    display: block;
}

.user-name {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

.user-role {
    color: #9ca3af;
    font-size: 0.75rem;
}

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

.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #111827;
}

.header-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.btn-copilot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background-color: #f3f4f6;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-copilot:hover {
    background-color: #e5e7eb;
}

.btn-copilot.active {
    background-color: #2563eb;
    color: white;
}

.btn-copilot.active:hover {
    background-color: #1d4ed8;
}

.content-area {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    margin-right: 0;
    transition: margin-right 0.3s ease;
}

.content-area.with-copilot {
    margin-right: 420px;
}

/* Copilot Panel */
.copilot-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: 420px;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.copilot-panel.open {
    transform: translateX(0);
}

.copilot-header {
    background: linear-gradient(to right, #2563eb, #7c3aed);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.copilot-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.copilot-icon {
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.copilot-title {
    font-weight: 600;
    font-size: 1rem;
}

.copilot-subtitle {
    font-size: 0.75rem;
    color: #bfdbfe;
    margin-top: 0.125rem;
}

.copilot-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.copilot-close:hover {
    color: white;
}

.copilot-quick-actions {
    padding: 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.quick-actions-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.quick-action-btn {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.quick-action-btn:hover {
    border-color: #93c5fd;
    background-color: #eff6ff;
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message-assistant {
    align-self: flex-start;
}

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

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-icon {
    font-size: 0.875rem;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    line-height: 1.5;
}

.message-assistant .message-content {
    background-color: #f3f4f6;
    color: #111827;
    border-top-left-radius: 0.25rem;
}

.message-user .message-content {
    background-color: #2563eb;
    color: white;
    border-top-right-radius: 0.25rem;
}

.copilot-input-container {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: white;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

#copilotInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    resize: none;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
}

#copilotInput:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.copilot-send-btn {
    padding: 0.75rem 1rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1.25rem;
    line-height: 1;
}

.copilot-send-btn:hover {
    background-color: #1d4ed8;
}

.copilot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards & Components */
.ai-insight-banner {
    background: linear-gradient(to right, #2563eb, #7c3aed);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.deal-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    transition: box-shadow 0.2s;
}

.deal-card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.deal-card.urgent {
    border-color: #fca5a5;
    background-color: #fef2f2;
}

.account-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.account-card.critical {
    border-color: #fca5a5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 0.5rem;
    max-width: 48rem;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    background: linear-gradient(to right, #2563eb, #7c3aed);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    transition: color 0.2s;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.875rem;
    line-height: 1.5;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

/* Grid Layouts */
.grid { 
    display: grid; 
}

.grid-cols-2 { 
    grid-template-columns: repeat(2, 1fr); 
}

.grid-cols-12 { 
    grid-template-columns: repeat(12, 1fr); 
}

.col-span-4 { 
    grid-column: span 4; 
}

.col-span-8 { 
    grid-column: span 8; 
}

.gap-4 { 
    gap: 1rem; 
}

.gap-6 { 
    gap: 1.5rem; 
}

/* Utility Classes */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-gray-900 { color: #111827; }
.text-gray-700 { color: #374151; }
.text-gray-600 { color: #4b5563; }
.text-gray-500 { color: #6b7280; }

.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Scrollbar Styling */
.copilot-messages::-webkit-scrollbar,
.content-area::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.copilot-messages::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.copilot-messages::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.copilot-messages::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .copilot-panel {
        width: 100%;
    }
    
    .content-area.with-copilot {
        margin-right: 0;
    }
    
    .grid-cols-12 {
        grid-template-columns: 1fr;
    }
    
    .col-span-4,
    .col-span-8 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .sidebar-open {
        width: 80px;
    }
    
    .sidebar-title,
    .nav-label,
    .nav-badge,
    .user-info {
        display: none !important;
    }
}

/* Territory Map Styles */
.map-marker {
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 10;
}

.map-marker:hover {
    transform: scale(1.1);
    z-index: 20;
}

.map-marker-icon {
    font-size: 2rem;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.map-marker-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.map-marker:hover .map-marker-label {
    opacity: 1;
}

.map-marker-value,
.map-marker-time {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: #2563eb;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    white-space: nowrap;
}

.map-marker-time {
    background: #16a34a;
}

.map-marker-priority .map-marker-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.map-marker-appointment .map-marker-icon {
    font-size: 2.5rem;
}

.map-marker-opportunity .map-marker-icon {
    font-size: 2rem;
}