/*
 ==========================================================
 CETUSG PREMIUM 2.0 - DESIGN SYSTEM
 ==========================================================
*/

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

:root {
    /* --- COLOR TOKENS (LIGHT) --- */
    --brand-primary: #4F46E5;
    --brand-primary-soft: rgba(79, 70, 229, 0.1);
    --brand-primary-dark: #3730A3;
    
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-sidebar: #F8FAFC;
    --bg-topbar: #FFFFFF;
    
    --text-main: #0F172A;
    --text-soft: #64748B;
    --text-muted: #94A3B8;
    --text-on-brand: #FFFFFF;
    
    --border-color: #E2E8F0;
    --border-soft: #F1F5F9;
    
    /* Semantic Colors */
    --success: #10B981;
    --success-soft: #DCFCE7;
    --warning: #F59E0B;
    --warning-soft: #FEF3C7;
    --danger: #EF4444;
    --danger-soft: #FEE2E2;
    --info: #3B82F6;
    --info-soft: #DBEAFE;
    
    /* --- DESIGN TOKENS --- */
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows (Enterprise Level) */
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
    --shadow-brand: 0 8px 20px rgba(79, 70, 229, 0.15);
    
    /* Animations */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    
    /* Dimensions */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 72px;

    /* Material Design 3 Compat (Old mappings) */
    --md-sys-color-primary: var(--brand-primary);
    --md-sys-color-surface: var(--bg-main);
    --md-sys-color-on-surface: var(--text-main);
    --md-sys-color-on-surface-variant: var(--text-soft);
    --md-sys-color-outline: var(--border-color);
    --md-sys-color-surface-container: var(--bg-card);
}

/* --- DARK MODE TOKENS (PREMIUM GOLD & WHITE) --- */
[data-theme="dark"] {
    --bg-main: #020617; 
    --bg-card: #0F172A;
    --bg-sidebar: #020617;
    --bg-topbar: #0F172A;
    
    --text-main: #FFFFFF; 
    --text-soft: #F8FAFC; 
    --text-muted: #CBD5E1; 
    
    --border-color: #1E293B;
    --border-soft: #0F172A;
    
    --brand-primary: #FBBF24; 
    --brand-primary-soft: rgba(251, 191, 36, 0.15);
    --brand-secondary: #D97706;

    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.7);

    /* M3 Dark Mappings */
    --md-sys-color-on-surface: var(--text-main);
    --md-sys-color-on-surface-variant: var(--text-soft);
    --md-sys-color-outline: var(--border-color);
    --md-sys-color-surface-container: var(--bg-card);
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6,
[data-theme="dark"] b,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] label,
[data-theme="dark"] small,
[data-theme="dark"] strong {
    color: #FFFFFF !important;
}

[data-theme="dark"] .text-soft,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .sidebar-category {
    color: #CBD5E1 !important;
}

[data-theme="dark"] .sidebar-item:hover,
[data-theme="dark"] .sidebar-active {
    color: #FBBF24 !important;
}

/* --- FORM ELEMENTS DARK MODE FIX --- */
[data-theme="dark"] input, 
[data-theme="dark"] select, 
[data-theme="dark"] textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
    background-color: #1E293B !important;
    color: #FFFFFF !important;
    border-color: #334155 !important;
}

[data-theme="dark"] option {
    background-color: #1E293B !important;
    color: #FFFFFF !important;
}

/* Fix for dynamic search results/dropdowns */
[data-theme="dark"] .search-results,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .autocomplete-items,
[data-theme="dark"] [id*="results"],
[data-theme="dark"] [class*="results"] {
    background-color: #1E293B !important;
    color: #FFFFFF !important;
    border: 1px solid #334155 !important;
}

[data-theme="dark"] .search-item:hover,
[data-theme="dark"] .autocomplete-items div:hover {
    background-color: #334155 !important;
}

[data-theme="dark"] ::placeholder {
    color: #94A3B8 !important;
    opacity: 1;
}

/* --- GLOBAL DARK MODE VISIBILITY FIX --- */
[data-theme="dark"] *[style*="background: white"],
[data-theme="dark"] *[style*="background:white"],
[data-theme="dark"] *[style*="background: #fff"],
[data-theme="dark"] *[style*="background:#fff"],
[data-theme="dark"] *[style*="background: #ffffff"],
[data-theme="dark"] *[style*="background:#ffffff"],
[data-theme="dark"] *[style*="background: rgb(255, 255, 255)"],
[data-theme="dark"] *[style*="background:#f8fafc"],
[data-theme="dark"] *[style*="background: #f8fafc"] {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

/* Force white text on any element that might have inline dark colors */
[data-theme="dark"] *[style*="color: #000"],
[data-theme="dark"] *[style*="color:#000"],
[data-theme="dark"] *[style*="color: #0f172a"],
[data-theme="dark"] *[style*="color:#0f172a"],
[data-theme="dark"] *[style*="color: #1e293b"],
[data-theme="dark"] *[style*="color:#1e293b"],
[data-theme="dark"] *[style*="color: #475569"],
[data-theme="dark"] *[style*="color:#475569"] {
    color: #FFFFFF !important;
}

[data-theme="dark"] .chat-messages {
    background: var(--bg-main) !important;
}

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

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: Arial, sans-serif;
}

/* Layout Containers */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: calc(var(--sidebar-width) + 24px);
    margin-right: 12px;
    margin-top: 12px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    min-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
}

/* --- SIDEBAR (Premium Light Theme) --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar); /* Light Slate - Premium Light */
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1001;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.03);
}

.sidebar-header {
    height: auto;
    min-height: 80px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    background: var(--bg-sidebar);
}

.sidebar-header .logo {
    color: var(--md-sys-color-primary);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.sidebar-category {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 1.5rem 1rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.sidebar-category:hover {
    color: var(--brand-primary);
}

.sidebar-category i.chevron {
    transition: transform 0.3s ease;
}

.sidebar-category.open i.chevron {
    transform: rotate(180deg);
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.sidebar-group-items.open {
    max-height: 1500px;
    transition: max-height 0.5s ease-in;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 2px;
    border-radius: var(--radius-md);
    color: var(--text-soft);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-item i {
    font-size: 1.1rem;
    width: 20px;
    display: flex;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.sidebar-item:hover {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.sidebar-item:hover i {
    color: var(--brand-primary);
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 800;
}

.sidebar-active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container) !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.sidebar-active i {
    color: var(--md-sys-color-on-primary-container);
}

.sidebar-footer {
    padding: 1rem 16px 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-sidebar);
}

.sidebar-footer .sidebar-item {
    color: #EF4444;
}

.sidebar-footer .sidebar-item:hover {
    background: #FEF2F2;
    color: #DC2626;
}

.content-area {
    padding: 2rem;
    animation: fadeIn var(--transition-base);
}

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

@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

.skeleton {
    background: var(--border-soft);
    background-image: linear-gradient(to right, var(--border-soft) 0%, var(--bg-main) 20%, var(--border-soft) 40%, var(--border-soft) 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
    display: inline-block;
    position: relative;
    animation: shimmer 1.5s linear infinite forwards;
}

@keyframes pulse-critical {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.pulse-critical {
    animation: pulse-critical 2s infinite;
}

/* --- TOP BAR (M3 App Bar) --- */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--md-sys-color-surface-container-high);
    padding: 0 16px;
    height: 48px;
    border-radius: var(--radius-xl);
    width: 400px;
    transition: all 0.2s;
}

.search-bar:focus-within {
    background: var(--md-sys-color-surface-container-highest);
    box-shadow: var(--elevation-1);
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    color: var(--md-sys-color-on-surface);
    font-size: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.theme-toggle {
    background: var(--bg-surface-variant);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.user-name {
    color: var(--text-main);
}

/* --- PAGE HEADERS (New Component) --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 2.5rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.page-header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.page-header-icon {
    width: 64px;
    height: 64px;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.75rem;
    box-shadow: var(--shadow-brand);
    border: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.page-header-text h2 {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 4px 0;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.page-header-text p {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    .page-header-info {
        gap: 1rem;
    }
}


/* --- CONTENT AREA --- */
.glass-panel {
    background: var(--md-sys-color-surface-container);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: none;
    border: none;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border: 2px solid var(--md-sys-color-primary);
    padding: calc(0.875rem - 1px) calc(1rem - 1px);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* --- BUTTONS (M3 style) --- */
.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

.btn-primary { 
    background: var(--md-sys-color-primary); 
    color: var(--md-sys-color-on-primary); 
}
.btn-primary:hover { 
    box-shadow: var(--elevation-2);
    filter: brightness(1.1);
}

.btn-secondary { 
    background: var(--md-sys-color-secondary-container); 
    color: var(--md-sys-color-on-secondary-container); 
}
.btn-secondary:hover { 
    background: var(--md-sys-color-surface-variant);
}

.btn-success { background: #10B981; color: #FFFFFF; }
.btn-danger { background: #EF4444; color: #FFFFFF; }

.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }

.btn-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    color: var(--text-soft);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--brand-soft);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* --- BADGES --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* --- UI COMPONENTS --- */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

/* --- TABLES --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    min-width: 600px; /* Impede que tabelas fiquem ilegíveis no celular */
}

th {
    background: var(--md-sys-color-surface-container-high);
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

tr:hover td {
    background: var(--border-soft);
}

/* --- MODALS --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: all 0.3s;
}

.modal.active .modal-content {
    transform: translateY(0);
}

/* --- CHAT SYSTEM --- */
.chat-panel {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    width: 400px;
    height: 600px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 1002;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-minimized {
    height: 60px !important;
}

.chat-header {
    padding: 1.25rem;
    background: var(--brand-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    background: #F8FAFC;
    padding: 1.5rem;
    overflow-y: auto;
}

.msg {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    max-width: 85%;
    font-size: 0.9rem;
    position: relative;
}

.msg-sent {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #4338ca 100%);
    color: #FFFFFF;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(91, 33, 182, 0.15);
}

.msg-received {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-soft);
}

.msg-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 0.4rem;
    display: block;
    text-align: right;
    font-weight: 500;
}

/* --- PEIXINHO IA --- */
.peixinho-btn {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.peixinho-btn:hover {
    transform: scale(1.1);
}

.peixinho-btn img {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* --- MOBILE ADAPTATIONS --- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: 280px; z-index: 1001; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; margin-right: 0; margin-top: 0; border-radius: 0; }
    .hamburger { display: flex !important; }
    .search-bar { width: 100%; display: none; }
    .content-area { padding: 1rem; }
    .chat-panel { width: calc(100% - 2rem); right: 1rem; bottom: 1rem; }
}

@media (max-width: 768px) {
    .stat-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 0 1rem; }
    .user-name { display: none; }
    .btn-primary, .btn-secondary { width: 100%; }
    
    /* Responsive Content Area */
    .content-area { padding: 1rem; }
    .main-content { margin-left: 0; margin-right: 0; margin-top: 0; border-radius: 0; min-height: 100vh; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.5rem; }
    
    /* Responsive Modals */
    .modal-content {
        padding: 1.5rem 1rem !important;
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh !important;
        margin: 1rem auto;
    }
    
    /* Responsive Grids Global */
    .form-group[style*="grid-column"] {
        grid-column: span 1 !important;
    }
    div[style*="display: grid"], 
    div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* --- EMOJI PICKER --- */
#emojiPicker {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 320px;
    display: none;
    flex-direction: column;
    z-index: 1003;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 5px;
}

.emoji-item:hover {
    background: var(--bg-main);
}
/* --- ANNOUNCEMENT MODAL (M3 Glassmorphism) --- */
#announcementModal .glass-panel {
    background: rgba(15, 23, 42, 0.8); /* Increased opacity for solid elegant look without GIF */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0;
    overflow: hidden;
    border-radius: 2.5rem;
    position: relative;
    max-width: 950px;
    width: 95%;
    color: white;
    box-shadow: 0 40px 120px rgba(0,0,0,0.8);
    animation: modalPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.announcement-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.announcement-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6) contrast(1.2) hue-rotate(-10deg);
}

.announcement-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 3rem;
    padding: 3.5rem;
}

@media (max-width: 850px) {
    .announcement-main { grid-template-columns: 1fr; padding: 2rem; text-align: center; }
    .announcement-image { max-width: 300px; margin: 0 auto; }
}

.announcement-text h2 {
    font-size: 3.2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1.5px;
}

.announcement-scroll {
    max-height: 250px;
    overflow-y: auto;
    font-size: 1.1rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.85);
    margin-bottom: 2.5rem;
    padding-right: 1.5rem;
    text-align: left;
}

.announcement-scroll::-webkit-scrollbar { width: 4px; }
.announcement-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; }

/* --- COMMAND PALETTE (CTRL+K) --- */
.palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    animation: fadeIn var(--transition-fast);
}

.palette-container {
    width: 600px;
    max-width: 95vw;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: slideUp var(--transition-base);
}

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

.palette-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.palette-header i {
    color: var(--brand-primary);
    font-size: 1.2rem;
}

.palette-header input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 500;
}

.palette-header kbd {
    background: var(--bg-main);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-soft);
    border: 1px solid var(--border-color);
}

.palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.1s;
    color: var(--text-soft);
}

.palette-item i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    border-radius: 8px;
    font-size: 1rem;
}

.palette-item.active {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.palette-item.active i {
    background: var(--brand-primary);
    color: white;
}

.palette-item-info {
    display: flex;
    flex-direction: column;
}

.palette-item-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.palette-item-category {
    font-size: 0.75rem;
    opacity: 0.7;
}

.palette-chevron {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.5;
}

.palette-footer {
    padding: 0.75rem 1.25rem;
    background: var(--bg-main);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.palette-footer kbd {
    font-family: inherit;
    background: var(--bg-card);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.palette-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* --- COMMAND CENTER DASHBOARD --- */
.dashboard-grid-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-grid-main {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

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

@media (max-width: 1200px) {
    .grid-col-8, .grid-col-4 { grid-column: span 12; }
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-bg-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.05;
    transform: rotate(-15deg);
    color: var(--text-main);
}

.stat-subtext {
    font-size: 0.75rem;
    color: var(--text-soft);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-soft);
    font-weight: 400;
}

/* Timeline Activity */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: -15px;
    width: 2px;
    background: var(--border-soft);
}

.timeline-icon {
    width: 32px;
    height: 32px;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    z-index: 1;
}

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin: 2px 0;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Birthday List */
.birthday-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.birthday-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.2s;
}

.birthday-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.birthday-avatar {
    width: 40px;
    height: 40px;
    background: white;
    color: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    overflow: hidden;
}

.birthday-info .name {
    font-weight: 700;
    font-size: 0.9rem;
}

.birthday-info .action {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Modern Table Adjustments */
.modern-table th {
    background: none;
    border-bottom: 2px solid var(--border-soft);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 12px 16px;
}

.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.btn-text {
    font-size: 0.85rem;
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
}

.btn-text:hover {
    text-decoration: underline;
}

.chart-container {
    height: 300px;
    position: relative;
}


/* --- CHAT ARRASTAO TECH (ULTRA PREMIUM STYLE) --- */
.chat-pinned-bar {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #2c4a7c, #1a3560);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(26, 53, 96, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.2);
}

.chat-pinned-bar i { font-size: 28px; color: white !important; }

.chat-panel {
    position: fixed;
    bottom: 105px;
    right: 25px;
    width: 380px;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.4);
    z-index: 10000;
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: widgetIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes widgetIn {
    from { opacity: 0; transform: translateY(40px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* User List Premium */
.chat-user-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.chat-user-item:hover { background: rgba(44, 74, 124, 0.05); }

.chat-avatar-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
}

.chat-avatar-img, .chat-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: #e2e8f0;
    color: #2c4a7c;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}
.status-indicator.online { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-indicator.offline { background: #94a3b8; }

.chat-user-name { font-weight: 700; color: #1e293b; font-size: 0.95rem; }

/* Input Actions */
.chat-input-actions {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: #f8fafc;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.action-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.action-btn:hover { background: #2c4a7c; color: white; border-color: #2c4a7c; }

/* Mensagens */
.message-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    max-width: 85%;
    line-height: 1.4;
}

.msg-sent { background: linear-gradient(135deg, #2c4a7c, #1a3560); color: white; border-bottom-right-radius: 4px; }
.msg-received { background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }

/* Barra de Rolagem */
.chat-messages-container::-webkit-scrollbar { width: 5px; }
.chat-messages-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

/* --- INTERNAL CHAT COMPONENTS --- */
.chat-user-list {
    width: 320px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.chat-header-list {
    height: 60px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.chat-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.chat-company-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.9rem;
}

.chat-header-actions {
    display: flex;
    gap: 15px;
    color: var(--text-soft);
}

.chat-header-actions i {
    cursor: pointer;
    transition: color 0.2s;
}

.chat-header-actions i:hover {
    color: var(--brand-primary);
}

.chat-search-container {
    padding: 10px;
    background: var(--bg-card);
}

.chat-search-input-wrapper {
    background: var(--bg-main);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.chat-search-input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.85rem;
    width: 100%;
    color: var(--text-main);
}

.chat-user-list-content {
    flex: 1;
    overflow-y: auto;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
}

/* Chat Scrollbar */
.chat-user-list-content::-webkit-scrollbar { width: 6px; }
.chat-user-list-content::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 10px; }


/* --- CHAT JS COMPONENTS --- */
.chat-user-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.chat-user-item:hover {
    background: var(--bg-main);
}

.chat-user-item.active {
    background: var(--brand-primary-soft);
}

.chat-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.status-indicator.online { background: #10b981; }
.status-indicator.offline { background: #94a3b8; }

.chat-user-details {
    flex: 1;
    min-width: 0;
}

.chat-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.chat-user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread-badge {
    background: #25d366;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 800;
}

.chat-user-status-text {
    font-size: 0.8rem;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Message Wrappers */
.message-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.message-wrapper.sent { align-items: flex-end; }
.message-wrapper.received { align-items: flex-start; }

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-soft);
}

.fa-check-double.read { color: #53bdeb; }

.chat-msg-img {
    max-width: 280px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.chat-msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    text-decoration: none;
    background: var(--bg-main);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.chat-msg-file i { font-size: 1.5rem; color: #ef4444; }
.chat-msg-file span { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; }


/* --- FLOATING SIDEBAR CHAT (PREMIUM) --- */
.chat-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: 20px;
    width: 400px; /* Largura compacta enterprise */
    max-width: calc(100vw - 40px);
    height: auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: -10px 0 50px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-user-list {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

/* Quando uma conversa está ativa, a lista encolhe ou some no modo compacto */
.chat-panel.convo-active .chat-user-list {
    display: none; /* No modo compacto lateral, focamos na conversa */
}

.chat-main {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
}

.chat-panel.convo-active .chat-main {
    display: flex;
}

/* Botão de Voltar para a lista no modo lateral */
.btn-back-chat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .chat-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        border-radius: 0;
    }
}


/* --- SIDEBAR CHAT HEADER --- */
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-convo-info {
    display: flex;
    flex-direction: column;
}

.btn-back-chat {
    background: none;
    border: none;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.2s;
}

.btn-back-chat:hover {
    color: var(--brand-primary);
}


/* --- CHAT INTERNAL REFACTOR --- */
.chat-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

.chat-welcome-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.chat-welcome-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.chat-welcome-card i {
    font-size: 3rem;
    color: #10b981;
    margin-bottom: 1.5rem;
}

.chat-welcome-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.chat-welcome-card p {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.chat-input-area {
    padding: 12px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    position: relative;
}

.chat-input-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-input-wrapper i {
    color: var(--text-soft);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
}

.chat-input-wrapper i:hover { color: var(--brand-primary); }

.chat-input-field {
    flex: 1;
    background: var(--bg-main);
    border-radius: 12px;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
}

.chat-input-field input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.95rem;
}

.chat-emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow-lg);
    width: 250px;
    z-index: 1000;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    font-size: 1.5rem;
    text-align: center;
}

.emoji-grid span {
    cursor: pointer;
    transition: transform 0.2s;
}

.emoji-grid span:hover { transform: scale(1.3); }


/* --- UNIVERSAL COMPATIBILITY FIXES --- */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.chat-panel {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

@media (max-width: 768px) {
    .chat-panel {
        height: 100vh !important;
        height: 100dvh !important; /* Suporte para altura dinâmica mobile */
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 0 !important;
    }
    
    .chat-messages-container {
        -webkit-overflow-scrolling: touch; /* Scroll suave no iOS */
    }
}

@-webkit-keyframes slideInRight {
    from { -webkit-transform: translateX(100%); opacity: 0; }
    to { -webkit-transform: translateX(0); opacity: 1; }
}

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

/* Fallback para navegadores sem backdrop-filter */
@supports not (backdrop-filter: blur(20px)) {
    .chat-panel {
        background: var(--bg-card) !important;
    }
}



/* --- CHAT ARRASTAO TECH (FINAL FLOATING STYLE) --- */
.chat-pinned-bar {
    position: fixed !important;
    bottom: 25px !important;
    right: 25px !important;
    width: 65px !important;
    height: 65px !important;
    background: linear-gradient(135deg, #2c4a7c, #1a3560) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 9999 !important;
    box-shadow: 0 8px 32px rgba(26, 53, 96, 0.4) !important;
    border: 2px solid rgba(255,255,255,0.2) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.chat-panel {
    position: fixed !important;
    bottom: 105px !important;
    right: 25px !important;
    z-index: 10000 !important;
}

@media (max-width: 768px) {
    .chat-panel {
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* UNIVERSAL MOBILE FAILSAFE: Prevent content from stretching the screen */
    .app-container, .main-content, .content-area, .glass-panel, .card, .page-header {
        min-width: 0 !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    h1, h2, h3, h4, h5, h6, p, span, div {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }

    .page-header h1 {
        font-size: 1.6rem !important;
    }
    
    .page-header p {
        font-size: 0.95rem !important;
    }

    form, .form-group {
        flex-wrap: wrap !important;
        min-width: 0 !important;
    }

    input, select, textarea, button {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .rh-tabs, .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        max-width: 100vw;
        -webkit-overflow-scrolling: touch;
    }
}
