:root {
    /* Colors - Cinema/Festival Premium Theme */
    --bg-app: #0a0a0c;
    --bg-panel: #121115;
    --bg-card: #222129;

    --primary: #d93838;
    /* Festival Red (CTA) */
    --primary-hover: #b91c1c;

    --primary-hover: #b91c1c;

    --accent-gold: #d4af37;
    /* Dourado / Âmbar Premium */
    --gold-glow: rgba(212, 175, 55, 0.4);

    --text-main: #eae8e3;
    --text-muted: #a19d94;

    --border: #3f3c46;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;

    /* Radius */
    --radius: 8px;
    --radius-lg: 16px;

    /* Shadows & Effects */
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
    /* Profundidade cinematográfica (sem neon) */
    --glass-bg: rgba(38, 36, 44, 0.65);
    /* Mais translúcido e amigavelmente claro */
    --glass-border: rgba(255, 255, 255, 0.12);
}

/* SISTEMA GLOBAL: GLASS PREMIUM (Base para cards da interface) */
.glass-card,
.kanban-card,
.action-card {
    background: var(--glass-bg) !important;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 100%) !important;
    backdrop-filter: blur(20px) !important;
    /* Mais blur: realismo / profundidade */
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow:
        var(--shadow-premium),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        /* Borda top (1px translúcido premium) */
        inset 1px 0 0 rgba(255, 255, 255, 0.02) !important;
    /* Borda esquerda sutil */
    position: relative;
    z-index: 1;
    /* Criação de pilha para layering protegido */
}

/* Layering Defensivo: Força o texto/conteúdo ficar smpr na FRNTE do vidro/ilustrações */
.glass-card>*:not([style*="position: absolute"]),
.kanban-card>*:not([style*="position: absolute"]),
.action-card>*:not([style*="position: absolute"]) {
    position: relative;
    z-index: 2;
}

/* Ilustrações/Decorativos Absolutos de Fundo (foguete, rolo, relógio, etc) */
.glass-card>div[style*="position: absolute"],
.action-card>div[style*="position: absolute"] {
    opacity: 0.35 !important;
    /* Brilho e presença aumentados de forma sofisticada */
    z-index: 0 !important;
    /* Proteção Z-index para afundá-los no card */
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.12)) contrast(1.3) brightness(1.2);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s !important;
}

/* Efeito orgânico de "despertar" nos ícones traseiros */
.glass-card:hover>div[style*="position: absolute"],
.action-card:hover>div[style*="position: absolute"] {
    opacity: 0.55 !important;
    transform: scale(1.15) translateY(-4px) rotate(3deg);
}

/* EXCEÇÕES CRÍTICAS (Camadas não transparentes de Modais/Tabelas) */
.modal-content,
.modal-overlay .glass-card,
.modal-content .glass-card,
.modal-content .kanban-card,
.modal-content .action-card,
.modal-content table {
    background: rgba(18, 17, 21, 0.96) !important;
    /* Blindagem de legibilidade / Fundo opaco base negro */
    backdrop-filter: blur(35px) !important;
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.95) !important;
}

.gradient-text {
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
}

.brand h1 {
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
    color: var(--primary);
}

.main-content {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-app);
    min-height: 0;
    overflow: hidden;
}

.top-bar {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    background-color: rgba(15, 17, 21, 0.9);
    position: relative;
}

.top-bar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary);
    /* Linha teatral fina */
}

.content-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-lg);
    scrollbar-gutter: stable;
}

/* Utilities */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(217, 56, 56, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px -3px rgba(217, 56, 56, 0.6);
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    padding: var(--space-lg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border);
}

/* Inputs */
input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
}

input:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

/* Loading Spinner Component */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.loading-spinner::after {
    content: "⏳";
    animation: spin 1s infinite linear;
    margin-left: 10px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Sidebar Inteligente */
.nav-active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    border-left: 3px solid var(--accent-gold) !important;
    border-radius: 8px;
    font-weight: 600;
}

.nav-badge {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border-radius: 20px;
    font-size: 0.75rem;
    padding: 2px 8px;
    margin-left: auto;
    font-weight: 700;
}

.nav-links a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    transform: translateX(4px);
}

/* AI Writing Assistant Chat Modal */
#modal-escrita-ia .modal-content {
    max-width: 600px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.chat-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.1);
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.chat-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    background: var(--bg-panel);
}

.chat-input {
    flex: 1;
    margin-bottom: 0 !important;
}

.btn-magic-ia {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
    border: none;
    color: white;
    padding: 4px 10px !important;
    font-size: 0.75rem !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-magic-ia:hover {
    transform: scale(1.05);
}

.suggestion-box {
    margin-top: 10px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px dashed var(--success);
    border-radius: 10px;
    font-style: italic;
}

.btn-apply-suggestion {
    margin-top: 8px;
    background: var(--success) !important;
    color: white;
    font-size: 0.8rem !important;
    padding: 5px 12px !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble {
    animation: fadeIn 0.3s ease-out;
}

/* Budget Table Styles */
.budget-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.budget-table th {
    text-align: left;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.budget-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.budget-table input {
    margin-bottom: 0 !important;
    padding: 6px 10px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
}

.budget-table input:focus {
    border-color: var(--primary) !important;
    background: var(--bg-app) !important;
}

.budget-total-row {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.05) 0%, rgba(212, 175, 55, 0) 100%);
    font-weight: 800;
    font-size: 1.25rem;
    /* Impacto tipográfico valores financeiros MAIOR */
    letter-spacing: -0.02em;
}

.budget-total-row td {
    border-top: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    text-shadow: 0 0 15px var(--gold-glow);
}

/* -----------------------------------------
   CRM KANBAN STYLES 
   ----------------------------------------- */
.crm-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    height: calc(100vh - 140px);
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 320px;
    background: rgba(24, 27, 33, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.kanban-header {
    padding: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    letter-spacing: 0.02em;
    /* Hierarquia mais limpa no CRM */
}

.kanban-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.kanban-header .count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.kanban-cards {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: grab;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    border: 2px dashed rgba(99, 102, 241, 0.8);
    transform: scale(0.98);
}

.kanban-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.kanban-card:active {
    cursor: grabbing;
}

.card-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    margin-bottom: 8px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.card-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: #fff;
    letter-spacing: -0.01em;
}

.card-value {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    margin-top: 4px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: #fff;
}

.btn-pitch {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-pitch:hover {
    background: rgba(16, 185, 129, 0.25);
}

/* Colores specíficas das colunas */
.col-radar .kanban-header-dot {
    background: #6b7280;
}

.col-radar .kanban-header {
    border-bottom-color: #6b7280;
}

.col-abordagem .kanban-header-dot {
    background: #f59e0b;
}

.col-abordagem .kanban-header {
    border-bottom-color: #f59e0b;
}

.col-negociacao .kanban-header-dot {
    background: #3b82f6;
}

.col-negociacao .kanban-header {
    border-bottom-color: #3b82f6;
}

.col-docs .kanban-header-dot {
    background: #f97316;
}

.col-docs .kanban-header {
    border-bottom-color: #f97316;
}

.col-fechado .kanban-header-dot {
    background: #10b981;
}

.col-fechado .kanban-header {
    border-bottom-color: #10b981;
}


/* -----------------------------------------
   ACCORDION / COLLAPSIBLE SECTIONS PREMIUM
   ----------------------------------------- */
.accordion-item {
    background: var(--bg-panel) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
    margin-bottom: 24px !important;
    margin-top: 24px !important;
    /* FORÇA o distanciamento exato caso o grid do navegador falhe */
    display: block !important;
    /* Evita que fujam do fluxo */
    width: 100% !important;
    overflow: hidden !important;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    position: relative;
    clear: both !important;
}

.accordion-item:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    transform: translateY(-2px) !important;
}

.accordion-item.is-open {
    border-color: var(--primary) !important;
    box-shadow: 0 16px 48px -12px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.accordion-header {
    padding: 20px 24px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%) !important;
    user-select: none !important;
    transition: background 0.3s ease !important;
}

.accordion-item.is-open .accordion-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

.accordion-title {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--text-main) !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
}

.accordion-icon {
    font-size: 1.1rem !important;
    color: var(--text-muted) !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.accordion-item:hover .accordion-icon {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.accordion-item.is-open .accordion-icon {
    transform: rotate(180deg) !important;
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.15) !important;
}

.accordion-content {
    display: grid !important;
    grid-template-rows: 0fr !important;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.accordion-item.is-open .accordion-content {
    grid-template-rows: 1fr !important;
}

.accordion-inner {
    overflow: hidden !important;
    padding: 0 24px !important;
    transition: padding 0.35s ease !important;
    background: rgba(0, 0, 0, 0.2) !important;
}

.accordion-item.is-open .accordion-inner {
    padding: 24px !important;
}

/* ==========================================
   WATERMARK (BRANDING GLOBAL)
   ========================================== */
.main-content {
    position: relative;
    z-index: 1;
}

.main-content::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 55%;
    /* Shift slightly right to balance the sidebar */
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vh;
    background-image: url('monster_logo_02_branco.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.04;
    pointer-events: none;
    z-index: -1;
}