:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    
    --bg-platform: #f5f5f5;
    --bg-sidebar: #fafafa;
    --bg-content: #fafafa;
    --bg-hover: #f0f0f0;
    --bg-active: #eff6ff;
    --border-color: #e0e0e0;
    --text-primary: #0a0a0a;
    --text-secondary: #525252;
    --text-tertiary: #737373;
    --active-text: var(--primary);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;

    /* Semantic status colors */
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Cards & inputs */
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #e5e7eb;

    /* Info alerts */
    --info-bg: #e0f2fe;
    --info-border: #bae6fd;
    --info-text: #075985;
    --info-text-strong: #0c4a6e;

    /* Disabled state */
    --disabled-bg: #f3f4f6;
    --disabled-text: #9ca3af;

    /* Section headers */
    --section-header-bg: #f9fafb;

    /* Muted text */
    --text-muted: #6c757d;
}

[data-theme="dark"] {
    --bg-platform: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-content: #1e293b;
    --bg-hover: #334155;
    --bg-active: #1e3a5f;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);

    --success: #34d399;
    --success-dark: #10b981;
    --danger: #f87171;
    --warning: #fbbf24;

    --card-bg: #1e293b;
    --input-bg: #1e293b;
    --input-border: #334155;

    --info-bg: #1e3a5f;
    --info-border: #1e40af;
    --info-text: #93c5fd;
    --info-text-strong: #dbeafe;

    --disabled-bg: #0f172a;
    --disabled-text: #64748b;

    --section-header-bg: #0f172a;

    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-platform);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, background 0.3s ease;
}

.sidebar-header {
    height: var(--topbar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo svg {
    height: 75px;
    width: auto;
}

[data-theme="light"] .logo-rect-base {
    fill: #1a365d;
}

[data-theme="light"] .logo-rect-accent {
    fill: #3b82f6;
}

[data-theme="light"] .logo-text {
    fill: #1a365d;
}

[data-theme="light"] .logo-subtext {
    fill: #334155;
}

[data-theme="light"] .logo-ia-text {
    fill: #3b82f6;
}

[data-theme="dark"] .logo-rect-base {
    fill: #e2e8f0;
}

[data-theme="dark"] .logo-rect-accent {
    fill: #0f172a;
}

[data-theme="dark"] .logo-text {
    fill: #f1f5f9;
}

[data-theme="dark"] .logo-subtext {
    fill: #94a3b8;
}

[data-theme="dark"] .logo-ia-text {
    fill: #60a5fa;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    padding: 0 12px;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.nav-item {
    list-style: none;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 14px;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-active);
    color: var(--active-text);
    font-weight: 600;
}

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

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
}

.nav-badge-free {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: #10b981; 
    color: white;
    border-radius: 10px;
}

[data-theme="dark"] .nav-badge-free {
    background: #059669;
}

.nav-badge-soon {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--text-tertiary);
    color: white;
    border-radius: 10px;
    opacity: 0.7;
}

.nav-link.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.topbar {
    position: fixed;
    left: var(--sidebar-width);
    top: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    transition: background 0.3s ease;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-btn i {
    font-size: 20px;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    margin-left: 8px;
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

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

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

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

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 24px;
}

.content-header {
    margin-bottom: 24px;
}

.content-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.content-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.card {
    background: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: background 0.3s ease, border 0.3s ease;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 20px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-content);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

.notifications-container {
    position: fixed;
    top: calc(var(--topbar-height) + 16px);
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.notification {
    background: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.notification-success .notification-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-dark);
}

.notification-danger .notification-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.notification-warning .notification-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.notification-info .notification-icon {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary);
}

[data-theme="dark"] .notification-success .notification-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

[data-theme="dark"] .notification-danger .notification-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

[data-theme="dark"] .notification-warning .notification-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

[data-theme="dark"] .notification-info .notification-icon {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

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

.mobile-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: flex;
    }

    .user-info {
        display: none;
    }
}

.text-muted {
    color: var(--text-secondary);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: var(--bg-active);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-dark);
}

[data-theme="dark"] .badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.csrf-error-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.csrf-error-modal.active {
    display: flex;
}

.csrf-error-content {
    background: var(--bg-sidebar);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: csrfSlideIn 0.3s ease;
}

@keyframes csrfSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csrf-error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
}

.csrf-error-content h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.csrf-error-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.csrf-error-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.csrf-error-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.notifications-dropdown {
display: none;
position: absolute;
top: calc(100% + 8px);
right: 0;
width: 380px;
max-height: 500px;
background: var(--bg-sidebar);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
box-shadow: var(--shadow-md);
z-index: 9999;
overflow: hidden;
}

.notifications-dropdown.show {
display: flex;
flex-direction: column;
}

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

.notifications-header h3 {
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}

.mark-all-read {
font-size: 13px;
color: var(--primary);
cursor: pointer;
background: none;
border: none;
padding: 4px 8px;
border-radius: 4px;
transition: all 0.15s;
}

.mark-all-read:hover {
background: var(--bg-hover);
}

.notifications-list {
overflow-y: auto;
max-height: 400px;
}

.notification-item {
padding: 16px 20px;
border-bottom: 1px solid var(--border-color);
cursor: pointer;
transition: background 0.15s;
text-decoration: none;
display: block;
color: inherit;
}

.notification-item:hover {
background: var(--bg-hover);
}

.notification-item.unread {
background: var(--bg-active);
}

.notification-item.unread::before {
content: '';
position: absolute;
left: 8px;
top: 50%;
transform: translateY(-50%);
width: 6px;
height: 6px;
background: var(--primary);
border-radius: 50%;
}

.notification-item-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 4px;
}

.notification-item-title {
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
flex: 1;
}

.notification-item-date {
font-size: 11px;
color: var(--text-tertiary);
}

.notification-item-message {
font-size: 13px;
color: var(--text-secondary);
line-height: 1.4;
}

.notifications-empty {
padding: 40px 20px;
text-align: center;
color: var(--text-tertiary);
}

.notifications-empty i {
font-size: 48px;
margin-bottom: 12px;
opacity: 0.3;
}

.topbar-btn {
position: relative;
}

@media (max-width: 500px) {
.notifications-dropdown {
    width: calc(100vw - 32px);
    right: -140px;
}
}

.contact-fab-container {
position: fixed;
bottom: 24px;
right: 24px;
z-index: 9998;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 12px;
}

.contact-fab-main {
width: 56px;
height: 56px;
border-radius: 50%;
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
border: none;
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
}

.contact-fab-main:hover { transform: scale(1.1); }
.contact-fab-main.active { 
transform: scale(1.05);
}
.contact-fab-main i { font-size: 24px; }

.contact-options {
display: flex;
flex-direction: column;
gap: 12px;
opacity: 0;
visibility: hidden;
transform: translateY(20px);
transition: all 0.3s;
}

.contact-options.show {
opacity: 1;
visibility: visible;
transform: translateY(0);
}

.contact-option {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 20px;
background: var(--bg-content);
border: 1px solid var(--border-color);
border-radius: 28px;
text-decoration: none;
color: var(--text-primary);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.2s;
font-weight: 500;
}

.contact-option:hover {
transform: translateX(-8px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.contact-option-icon {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
}

.contact-option.whatsapp .contact-option-icon {
background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
color: white;
}

.contact-option.email .contact-option-icon {
background: linear-gradient(135deg, #ea4335 0%, #c5221f 100%);
color: white;
}

.contact-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9997;
display: none;
}

.contact-overlay.active { display: block; }

@keyframes pulse {
0%, 100% { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); }
50% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6); }
}

.contact-fab-main:not(.active) {
animation: pulse 3s infinite;
}

/* ===== Progress Bar (navegação) ===== */
.htmx-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.htmx-progress-bar.active {
    opacity: 1;
    animation: nav-progress 1.5s ease-in-out forwards;
}

@keyframes nav-progress {
    0%   { width: 0; }
    20%  { width: 30%; }
    50%  { width: 60%; }
    80%  { width: 85%; }
    100% { width: 95%; }
}

/* ===== View Transitions (navegação suave entre páginas - Chrome 126+) ===== */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: vt-fade-out 0.15s ease-out forwards;
}

::view-transition-new(root) {
    animation: vt-fade-in 0.2s ease-in forwards;
}

@keyframes vt-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes vt-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Respeitar preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}
}
