/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --bg-main: #090d16;
    --bg-sidebar: #0f1524;
    --bg-card: rgba(20, 27, 45, 0.65);
    --bg-input: #172033;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #6366f1;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #627289;
    
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #a855f7;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, .brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar Layout (Desktop) */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.brand-text h1 {
    font-size: 18px;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.05));
    border-left: 3px solid var(--accent-indigo);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.badge {
    position: absolute;
    right: 16px;
    background-color: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

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

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

.user-info .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Bottom Navigation (Mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    z-index: 10;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    flex: 1;
    position: relative;
}

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

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

.bottom-nav-item .badge {
    top: -2px;
    right: 25%;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
}

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

.main-header h2 {
    font-size: 26px;
}

/* Card Styles */
.card, .dashboard-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-main);
    margin-bottom: 24px;
}

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

.card-header h3 {
    font-size: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    color: white;
}

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

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: var(--accent-red);
    color: white;
}

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

.btn-success {
    background-color: var(--accent-green);
    color: white;
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--accent-indigo);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.btn-text:hover {
    color: var(--accent-purple);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--accent-red);
}

.form-row {
    display: flex;
    gap: 20px;
}

.col-6 {
    flex: 1;
}

.form-select, input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], textarea {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
}

.form-select:focus, input:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

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

/* Dashboard Home */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-main);
}

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

.icon-blue { background-color: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-green { background-color: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.icon-orange { background-color: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.icon-purple { background-color: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.icon-red { background-color: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-val {
    font-size: 22px;
    font-weight: 700;
}

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

.category-bar-row {
    margin-bottom: 12px;
}

.category-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.progress-bar-bg {
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-indigo), var(--accent-purple));
    border-radius: 3px;
}

/* Leads List Table Styles */
.filter-bar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 40px;
}

.filter-controls {
    display: flex;
    gap: 12px;
}

.filter-controls select {
    width: 160px;
}

.leads-list-wrapper {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-main);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.leads-table th {
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
}

.leads-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.leads-table tbody tr {
    transition: var(--transition-fast);
}

.leads-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges for status colors */
.status-badge {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    display: inline-block;
    text-transform: capitalize;
}

.status-select {
    padding: 4px 20px 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    text-transform: capitalize;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
    transition: var(--transition-fast);
}

.status-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

.status-new { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.status-trying_to_connect { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-interested { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-partner { background-color: rgba(16, 185, 129, 0.3); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.5); }
.status-rejected { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }

.action-row {
    display: flex;
    gap: 8px;
}

.action-row .btn-sm {
    padding: 4px 8px;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* Login Overlay Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    transition: opacity var(--transition-normal);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-main);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-brand img {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.login-brand h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-brand p {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: var(--accent-red);
    background-color: rgba(239, 68, 68, 0.1);
}

.owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    border: 1px solid var(--border-color);
}

/* AI Discover Section styling */
.discover-form-container {
    margin-bottom: 24px;
}

.discover-intro {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.discover-magic-icon {
    font-size: 32px;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.discover-inputs {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.discover-inputs .form-group {
    flex: 2;
    margin-bottom: 0;
}

.discover-inputs .form-group.small-group {
    flex: 1;
}

.discover-inputs button {
    height: 42px;
    padding: 0 24px;
}

/* Loading spinner */
.discover-loading {
    text-align: center;
    padding: 60px 20px;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-indigo);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.discover-loading h4 {
    margin-bottom: 8px;
}

.discover-loading p {
    color: var(--text-muted);
    font-size: 13px;
}

/* Discovered Lead cards */
.discovered-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.discovered-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.discovered-card:hover {
    border-color: var(--accent-indigo);
    transform: translateY(-2px);
}

.discovered-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.discovered-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.discovered-category {
    font-size: 11px;
    background-color: var(--bg-input);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: inline-block;
}

.discovered-contact {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.discovered-contact p {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.discovered-contact p i {
    color: var(--text-muted);
}

/* Settings tab style */
.settings-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

.settings-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
}

.api-key-input-wrapper {
    position: relative;
    display: flex;
}

.api-key-input-wrapper input {
    padding-right: 46px;
}

.btn-toggle-visibility {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

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

.settings-actions {
    margin-top: 20px;
}

.db-actions {
    display: flex;
    gap: 12px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.modal {
    background-color: #0d1323;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-backdrop.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 820px;
}

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

.modal-header h3 {
    font-size: 18px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

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

.mr-auto {
    margin-right: auto;
}

/* Detail Modal Grid Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.detail-info-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-icon {
    color: var(--accent-indigo);
    font-size: 15px;
    text-decoration: none;
}

.action-icon.text-green {
    color: var(--accent-green);
}

.social-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.notes-display {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-line;
    max-height: 120px;
    overflow-y: auto;
}

/* AI Detail Cards (Right Panel) */
.detail-ai-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-card {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 16px;
}

.ai-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-card-title i {
    color: var(--accent-indigo);
}

.ai-card-title h4 {
    font-size: 14px;
    font-weight: 600;
}

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

.ai-text-container {
    background-color: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px;
    min-height: 100px;
    max-height: 160px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.4;
}

.ai-text-container .placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

.ai-text-container strong {
    color: var(--text-primary);
}

.btn-ai-action {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.03));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
}

.btn-ai-action:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.08));
    border-color: rgba(99, 102, 241, 0.6);
}

.ai-loading-spinner {
    margin-right: 6px;
}

.ai-suggestion-actions {
    display: flex;
    gap: 8px;
}

.ai-suggestion-actions button {
    flex: 1;
}

/* Alert Banner styling */
.alert-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #1e293b;
    border-left: 4px solid var(--accent-indigo);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(110%); }
    to { transform: translateX(0); }
}

.alert-message {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}

.btn-close-alert {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
}

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

/* General tab routing functionality */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    /* Hide desktop Sidebar, show bottom-nav */
    .sidebar {
        display: none;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-bottom: calc(84px + env(safe-area-inset-bottom)); /* Spacer for bottom nav respecting safe areas */
    }

    .main-header {
        margin-bottom: 20px;
    }
    
    .main-header h2 {
        font-size: 22px;
    }
    
    /* Stats grid columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .stat-val {
        font-size: 18px;
    }
    
    /* Layout stacks on mobile */
    .dashboard-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }

    .filter-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .filter-controls select {
        width: 100%;
    }
    
    /* Make tables card lists on mobile */
    .leads-table thead {
        display: none;
    }

    .leads-table tbody tr {
        display: block;
        border-bottom: 1px solid var(--border-color);
        padding: 16px 12px;
    }

    .leads-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: none;
        align-items: center;
        font-size: 13px;
    }

    .leads-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
        text-transform: capitalize;
    }

    .leads-table td > *:not(::before) {
        text-align: right;
        word-break: break-word;
        max-width: 65%;
    }
    
    .leads-table td.actions-td {
        justify-content: flex-end;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.03);
        margin-top: 6px;
    }

    .leads-table td.actions-td::before {
        display: none;
    }

    .action-row {
        gap: 12px;
    }

    /* Modal details grid stacking */
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .col-6 {
        width: 100%;
    }

    .discover-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .discover-inputs button {
        width: 100%;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
        margin: 10px auto;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header, .modal-footer {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .main-header .btn {
        width: 100%;
    }

    .login-card {
        padding: 24px 20px;
        margin: 10px;
        border-radius: 16px;
    }

    .login-brand img {
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
    }

    .login-brand h2 {
        font-size: 20px;
    }
}
