@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --sidebar-width: 260px;
    --bg-body: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-main: #000000;
    --text-muted: #4B5563;
    --border-color: #E5E7EB;
    --primary: #203c86;
    --primary-light: #f0f4ff;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --modal-bg: rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background-color: var(--bg-body); color: var(--text-main); min-height: 100vh; overflow-x: hidden; }

/* Layout Wrapper */
.layout-wrapper { display: flex; min-height: 100vh; max-width: 100vw; overflow-x: hidden; }

/* Sidebar Styles */
.sidebar { 
    width: var(--sidebar-width); 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    position: fixed; 
    height: 100vh; 
    transition: transform 0.3s ease;
    z-index: 1000;
}
.sidebar-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sidebar-header .logo { color: var(--primary); display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.sidebar-header .logo svg { width: 28px; height: 28px; }
.sidebar-header h2 { font-size: 1.125rem; font-weight: 400; color: var(--primary); }
.close-sidebar { display: none; cursor: pointer; color: var(--text-muted); }

.nav-links { flex: 1; padding: 1.5rem 0.75rem; list-style: none; }
.nav-item { margin-bottom: 0.25rem; }
.nav-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text-muted); text-decoration: none; border-radius: 8px; font-size: 0.875rem; font-weight: 400; transition: all 0.2s; }
.nav-link:hover { background: var(--bg-body); color: var(--text-main); }
.nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border-color); }

/* Main Content Layout */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Top Navbar */
.top-nav { 
    height: 77px; 
    background: var(--bg-sidebar); 
    border-bottom: 1px solid var(--border-color); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 1.5rem; 
    position: sticky; 
    top: 0;
    z-index: 900;
}
.mobile-toggle { display: none; cursor: pointer; color: var(--text-muted); }
.search-bar { display: flex; align-items: center; background: var(--bg-body); border-radius: 8px; padding: 0.4rem 0.75rem; width: 300px; border: 1px solid var(--border-color); }
.search-bar input { border: none; background: transparent; outline: none; margin-left: 0.4rem; width: 100%; font-size: 0.8125rem; }
.top-nav-right { display: flex; align-items: center; gap: 1rem; }
.user-profile { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; cursor: pointer; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 400; }
.user-info span { font-size: 0.65rem; font-weight: 400; display: block; text-align: center; }

/* Dashboard Body */
.container { padding: 1.5rem 2rem; width: 100%; margin: 0; }
.page-header { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: flex-end; }
.page-header h1 { font-size: 1rem; font-weight: 400; margin-bottom: 0.25rem; }
.page-header p { color: var(--text-muted); font-size: 0.875rem; }

/* Components: Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); padding: 1.25rem; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.stat-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.stat-icon { padding: 0.5rem; border-radius: 8px; background: var(--primary-light); color: var(--primary); }
.stat-trend { font-size: 0.75rem; font-weight: 400; display: flex; align-items: center; gap: 0.25rem; }
.trend-up { color: var(--success); }
.stat-card-body h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.stat-card-body p { font-size: 0.8125rem; color: var(--text-muted); }

/* Premium Stat Cards */
.p-stats-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 1.25rem; 
    margin-bottom: 2rem; 
}
.p-stats-grid-5 { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 1.25rem; 
    margin-bottom: 2rem; 
}
@media (max-width: 1200px) {
    .p-stats-grid, .p-stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .p-stats-grid, .p-stats-grid-5 { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
    .p-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
    .p-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .p-stats-grid { grid-template-columns: 1fr; }
}
.p-stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.p-stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

.p-stat-info { display: flex; flex-direction: column; gap: 0.25rem; }
.p-stat-title { font-size: 0.75rem; font-weight: 500; color: rgba(0,0,0,0.5); margin-bottom: 0.5rem; }
.p-stat-value { font-size: 1.5rem; font-weight: 400; margin-bottom: 0.25rem; }
.p-stat-trend { font-size: 0.6875rem; font-weight: 600; display: flex; align-items: center; gap: 0.25rem; }
.p-stat-subtext { font-size: 0.625rem; color: rgba(0,0,0,0.4); margin-top: 0.125rem; }

.p-stat-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.p-stat-icon-box svg { width: 20px; height: 20px; }

/* Color Variants (Updated for Gold Theme) */
.p-card-gold { background-color: #FFFFFF; color: #203c86; border: 1px solid #203c86; }
.p-card-gold .p-stat-icon-box { background-color: #f0f4ff; }
.p-card-gold .p-stat-trend { color: #203c86; }

.p-card-black { background-color: #000000; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.1); }
.p-card-black .p-stat-title { color: rgba(255, 255, 255, 0.6); }
.p-card-black .p-stat-icon-box { background-color: rgba(255, 255, 255, 0.1); }
.p-card-black .p-stat-trend { color: #203c86; }

.p-card-white { background-color: #FFFFFF; color: #000000; border: 1px solid var(--border-color); }
.p-card-white .p-stat-icon-box { background-color: var(--primary-light); color: var(--primary); }

/* Colored Pastel Card Variants — white backgrounds, colored icon box */
.p-card-blue  { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-blue  .p-stat-title  { color: var(--text-muted); }
.p-card-blue  .p-stat-value  { color: var(--text-main); }
.p-card-blue  .p-stat-trend  { color: #2563eb; }
.p-card-blue  .p-stat-subtext { color: var(--text-muted); }
.p-card-blue  .p-stat-icon-box { background-color: #dbeafe; color: #2563eb; }

.p-card-purple { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-purple .p-stat-title  { color: var(--text-muted); }
.p-card-purple .p-stat-value  { color: var(--text-main); }
.p-card-purple .p-stat-trend  { color: #7c3aed; }
.p-card-purple .p-stat-subtext { color: var(--text-muted); }
.p-card-purple .p-stat-icon-box { background-color: #ede9fe; color: #7c3aed; }

.p-card-orange { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-orange .p-stat-title  { color: var(--text-muted); }
.p-card-orange .p-stat-value  { color: var(--text-main); }
.p-card-orange .p-stat-trend  { color: #ea580c; }
.p-card-orange .p-stat-subtext { color: var(--text-muted); }
.p-card-orange .p-stat-icon-box { background-color: #ffedd5; color: #ea580c; }

.p-card-green  { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-green  .p-stat-title  { color: var(--text-muted); }
.p-card-green  .p-stat-value  { color: var(--text-main); }
.p-card-green  .p-stat-trend  { color: #16a34a; }
.p-card-green  .p-stat-subtext { color: var(--text-muted); }
.p-card-green  .p-stat-icon-box { background-color: #dcfce7; color: #16a34a; }

.p-card-cyan   { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-cyan   .p-stat-title  { color: var(--text-muted); }
.p-card-cyan   .p-stat-value  { color: var(--text-main); }
.p-card-cyan   .p-stat-trend  { color: #0891b2; }
.p-card-cyan   .p-stat-subtext { color: var(--text-muted); }
.p-card-cyan   .p-stat-icon-box { background-color: #cffafe; color: #0891b2; }

/* White Background / Bordered Variant (for other pages) */
.p-card-white { background-color: #FFFFFF; color: var(--text-main); border: 1px solid var(--border-color); }
.p-card-white .p-stat-title { color: var(--text-muted); }
.p-card-white .p-stat-icon-box { background-color: var(--primary-light); color: var(--primary); }

/* Spinner Animation */
@keyframes spin-loader {
    to { transform: rotate(360deg); }
}
.spin-loader {
    width: 56px;
    height: 56px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin-loader 0.9s linear infinite;
    margin: 0 auto 1.5rem;
}


/* Components: Table View */
.card-table { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-color); /* overflow: hidden REMOVED to allow dropdown overlap */ box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 0.9375rem; font-weight: 400; }
.table-responsive { 
    width: 100%; 
    overflow: visible; /* Changed from auto/hidden to ensure overflow content is seen */
    min-height: 480px; 
    padding-bottom: 200px; /* Space for the dropdown */
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; }
.table th { 
    text-align: left; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; 
    color: var(--text-muted); font-weight: 600; padding: 0.75rem 1.25rem; 
    background: #F9FAFB; border-bottom: 1px solid var(--border-color); 
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.table td { 
    padding: 0.875rem 1.25rem; 
    border-bottom: 1px solid var(--border-color); 
    font-size: 0.8125rem; 
    vertical-align: middle; 
    white-space: nowrap;
    overflow: visible; /* Ensure cells don't clip */
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: #FBFBFC; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 400; }
.badge-blue, .badge-gold { background: #f0f4ff; color: #203c86; }
.badge-green { background: #DCFCE7; color: #166534; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-red { background: #FEE2E2; color: #991B1B; }

/* Buttons */
button { font-family: inherit; }
.btn { padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.8125rem; font-weight: 400; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; font-family: inherit; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #192f69; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-body); border-color: var(--text-muted); }

/* Chart Styles */
.chart-container { width: 100%; height: 280px; padding: 1rem; position: relative; overflow: hidden; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-container {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}
.modal-overlay.active .modal-container {
    transform: translateY(0);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 1.125rem; font-weight: 400; }
.close-modal { cursor: pointer; color: var(--text-muted); transition: color 0.2s; }
.close-modal:hover { color: var(--text-main); }

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #F9FAFB;
}

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 400; margin-bottom: 0.5rem; color: var(--text-main); }
.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
    background: white;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Auth Pages */
.auth-container { 
    background: var(--bg-sidebar); 
    width: 100%; 
    max-width: 400px; 
    padding: 3rem 2.5rem; 
    border-radius: 16px; 
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); 
    border: 1px solid var(--border-color); 
}
.auth-logo { 
    font-size: 1.75rem; 
    font-weight: 400; 
    color: var(--primary); 
    text-align: center; 
    margin-bottom: 2.5rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.75rem; 
}
.auth-logo svg { width: 32px; height: 32px; }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.1); }
    .main-content { margin-left: 0; width: 100%; }
    .mobile-toggle { display: block; margin-right: 1rem; }
    .close-sidebar { display: block; }
    .search-bar { width: 180px; }
}

@media (max-width: 640px) {
    .stats-grid, .p-stats-grid { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .page-header div { width: 100%; }
    .page-header .btn, .page-header select, .page-header .custom-date-input { width: 100%; }
}

/* Special Grids */
.layout-two-cols { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 2rem; 
    align-items: flex-start;
}
.form-column { 
    display: flex; 
    flex-direction: column; 
    gap: 1.25rem; 
}

@media (max-width: 992px) {
    .layout-two-cols { grid-template-columns: 1fr; }
}

/* Live Chat Bubble Styles */
.live-chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(214, 173, 67, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.live-chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(214, 173, 67, 0.6);
}

.live-chat-bubble svg {
    width: 28px;
    height: 28px;
}

@media (max-width: 640px) {
    .live-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    .live-chat-bubble svg {
        width: 24px;
        height: 24px;
    }
}
/* --- New Contacts System Styles --- */

/* Score Badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.score-quente { background-color: #fee2e2; color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.score-morno { background-color: #fef3c7; color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.score-frio { background-color: #e0f2fe; color: #0ea5e9; border: 1px solid rgba(14, 165, 233, 0.2); }

.score-badge svg { width: 14px; height: 14px; }

/* Contact Profile Modal Refinement */
.profile-modal-container {
    max-width: 1200px !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.profile-modal-container .modal-body {
    overflow-y: auto;
    flex: 1;
}

.profile-header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 400;
    cursor: pointer;
    transition: transform 0.2s;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
}

/* Detailed Score Card (Photo Match) */
.score-card-detailed {
    background: white;
    border: 1.5px solid #fca5a5;
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    min-height: 250px;
}

.score-circle-container {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 400;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.score-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.score-points-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.score-point-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.score-point-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
}

.score-point-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.score-point-value {
    font-weight: 600;
    color: var(--text-dark);
}

/* Image Expansion Overlay */
.image-expand-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.image-expand-overlay.active {
    display: flex;
}

.image-expand-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}


.ltv-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.ltv-card-mini {
    background: #F9FAFB;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.ltv-card-mini span {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.ltv-card-mini h4 {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-main);
}

.profile-section-title {
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

/* Action Dropdown Styles */
.actions-cell {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 10px 40px rgba(0,0,0,0.2);
    z-index: 9999; /* Super high z-index */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
    overflow: visible; /* Ensure it's not internal clipping */
    padding: 0.5rem 0;
}

.actions-dropdown-content::before {
    content: "Ações do Contato";
    display: block;
    padding: 0.75rem 1.25rem;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.actions-dropdown-content a {
    color: var(--text-muted);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.actions-dropdown-content a:hover {
    background-color: #f0f7ff;
    color: var(--primary);
    padding-left: 1.5rem;
}

.actions-dropdown-content a.delete-action {
    color: #ef4444;
}

.actions-dropdown-content a.delete-action:hover {
    background-color: #fff5f5;
}

.actions-dropdown-content.show {
    display: block;
}

.actions-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Document Item Specifics */
.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #fdfdfd;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.2s;
}

.doc-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.doc-icon-box {
    width: 36px;
    height: 36px;
    background: #f0f4ff;
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo Tuning */
.sidebar-header .logo img {
    object-fit: contain;
    width: auto;
    max-width: 100%;
}

/* --- Expanded Profile Modal Components --- */
.profile-header-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2.5rem;
    align-items: stretch;
}

.profile-card {
    background: #fafafa;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.profile-card-info { background: #fafafa; }
.profile-card-ltv { background: #f0f7ff; border-color: #bfdbfe; }
.pro-card { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }

.ltv-total-badge {
    background: #1e40af;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 400;
}

.profile-section { margin-bottom: 2.5rem; }

.info-block {
    font-size: 0.875rem;
    color: var(--text-dark);
    background: #fafafa;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

.btn-doc { padding: 0.35rem; display: flex; align-items: center; justify-content: center; }
.doc-name { font-weight: 600; font-size: 0.8125rem; }
.doc-status { font-size: 0.65rem; margin-top: 0.15rem; }
.status-valid { color: #10B981; }
.status-pending { color: #f59e0b; }

.chart-box {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.history-table-container {
    margin-top: 1.5rem;
    overflow-x: auto;
}

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

.history-table th {
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.history-table td {
    padding: 1rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.history-table .val { font-weight: 600; }
.history-table .st-con {
    background: #DCFCE7;
    color: #166534;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* --- Final Responsiveness Overhaul --- */

@media (max-width: 1200px) {
    .profile-modal-container { width: 95% !important; }
    .profile-header-grid { gap: 1.5rem; }
}

@media (max-width: 992px) {
    .profile-header-grid { grid-template-columns: 1fr; }
    .ltv-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .docs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .container { padding: 1rem; }
    .sidebar { width: 240px; }
    
    .profile-modal-container { 
        width: 100% !important; 
        max-width: 100% !important; 
        border-radius: 0; 
        max-height: 100vh;
        overflow-x: auto; /* Added for mobile safety */
    }
    
    .profile-modal-container .modal-body { padding: 1.5rem; }
    .profile-section-title { font-size: 0.8125rem; }
    
    .modal-footer {
        padding: 1.5rem;
    }
    .modal-footer .btn-outline { display: none; }
    .modal-footer .btn-primary { 
        width: 100%; 
        padding: 1.25rem; 
        font-size: 1rem;
        height: auto;
    }
    
    .ltv-stats-grid { grid-template-columns: 1fr; }
    .ltv-card-mini h4 { font-size: 1rem; }
    
    .table-responsive { 
        padding-bottom: 100px; 
        overflow-x: auto !important; /* Fixing mobile overflow */
    }
    
    /* Top Nav on Mobile */
    .top-nav { padding: 0 1rem; }
}

@media (max-width: 480px) {
    .p-stat-value { font-size: 1.25rem; }
    .modal-header h3 { font-size: 1rem; }
    .btn { padding: 0.4rem 0.8rem; font-size: 0.75rem; }
}

/* --- Professional Micro-Animations --- */

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

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

.animate-fade-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Global Transition Rules */
.nav-link, .btn, .p-stat-card, .tier-card, .drop-zone {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Specific Hover Effects */
.nav-link:hover {
    padding-left: 1.25rem;
}

.p-stat-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.btn:active {
    transform: scale(0.97);
}

/* Staggered entrance for cards */
.p-stats-grid > div:nth-child(1) { animation-delay: 0.05s; }
.p-stats-grid > div:nth-child(2) { animation-delay: 0.1s; }
.p-stats-grid > div:nth-child(3) { animation-delay: 0.15s; }
.p-stats-grid > div:nth-child(4) { animation-delay: 0.2s; }

/* Existing chart canvas sizing */
#profileLtvChart canvas {
    width: 100% !important;
}

/* --- Checkout & Onboarding Flow --- */

.checkout-wrapper {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2.5rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.checkout-card {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

.order-summary {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.price-total {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    font-weight: 400;
    font-size: 1.25rem;
    color: var(--text-main);
}

/* Onboarding Wizard */
.onboarding-screen {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s;
}

.step-dot.active {
    width: 30px;
    border-radius: 10px;
    background: var(--primary);
}

/* Tier Selection */
.tier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    text-align: left;
}

.tier-card {
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tier-card:hover { border-color: var(--primary); transform: translateY(-4px); }
.tier-card.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 10px 20px rgba(32, 60, 134, 0.1); }

.tier-price { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin: 0.5rem 0; }
.tier-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* Financial Summary Box */
.investment-summary {
    background: #f0f4ff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px dashed var(--primary);
    margin-top: 2rem;
    display: none; /* Shown via JS */
    text-align: left;
}

/* File Upload Zones */
.upload-group { margin-bottom: 2rem; text-align: left; }
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.drop-zone:hover { border-color: var(--primary); background: #f8fafc; }
.drop-zone svg { width: 40px; height: 40px; color: var(--text-muted); margin-bottom: 1rem; }
.drop-zone-text { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); }

/* =============================================
   RESPONSIVIDADE GLOBAL — 3Click
   ============================================= */

/* --- Tablet landscape (≤1100px) --- */
@media (max-width: 1100px) {
    .p-stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .p-stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .checkout-wrapper { gap: 1.5rem; }
}

/* --- Tablet portrait (≤900px) --- */
@media (max-width: 900px) {
    .p-stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .tier-grid { grid-template-columns: repeat(2, 1fr); }
    .checkout-wrapper { grid-template-columns: 1fr; }
    .order-summary { position: static; margin-top: 1.5rem; }
    .layout-two-cols { grid-template-columns: 1fr; }
}

/* --- Mobile large (≤768px) --- */
@media (max-width: 768px) {
    .checkout-wrapper  { grid-template-columns: 1fr; gap: 1.25rem; }
    .tier-grid         { grid-template-columns: 1fr; }
    .order-summary     { position: static; margin-top: 1.5rem; }

    /* Page headers stack vertically */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .page-header > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    .page-header .btn,
    .page-header select,
    .page-header input {
        flex: 1;
        min-width: 120px;
    }

    /* Tables scroll horizontally */
    .card-table { overflow-x: auto; }
    .table-responsive { overflow-x: auto !important; padding-bottom: 80px; }
    .table { min-width: 600px; }

    /* Stat grids → 2 up on mobile */
    .p-stats-grid,
    .p-stats-grid-5 { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

    /* Checkout card padding tighter */
    .checkout-card  { padding: 1.5rem; }
    .order-summary  { padding: 1.25rem; }

    /* Onboarding card */
    .onboarding-card { padding: 1.5rem; }
    .qr-grid { grid-template-columns: 1fr !important; }

    /* Sidebar full-width overlay */
    .sidebar { width: 100%; max-width: 280px; }
}

/* --- Mobile small (≤480px) --- */
@media (max-width: 480px) {
    /* Single-column everything */
    .p-stats-grid,
    .p-stats-grid-5  { grid-template-columns: 1fr; }

    .p-stat-value   { font-size: 1.25rem; }
    .p-stat-card    { padding: 1rem; }

    /* Onboarding 2-col grids → 1 col */
    .tier-grid { grid-template-columns: 1fr; }

    /* Checkout doc-type grid */
    .doc-type-select { flex-direction: row; }

    /* Remove sticky on small screens */
    .order-summary { position: static; }

    /* Tighter containers */
    .container { padding: 0.75rem; }
    .checkout-header { padding-top: 3rem; }
    .checkout-card  { padding: 1.25rem; border-radius: 12px; }

    /* Form grid → single column */
    .form-group div[style*="grid"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 2fr"],
    div[style*="grid-template-columns: 3fr"] {
        grid-template-columns: 1fr !important;
    }

    .btn { font-size: 0.8rem; padding: 0.5rem 0.875rem; }
    .btn-primary { padding: 0.75rem 1.25rem; }

    /* Onboarding 2-col form grid → 1-col */
    .form-grid-2 { grid-template-columns: 1fr !important; }
}

/* Helper class for responsive 2-col form grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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