:root {
    --primary-color: #2F855A; /* IntelliBR Green */
    --primary-hover: #276749;
    --bg-color: #F7FAFC;
    --sidebar-bg: #FFFFFF;
    --text-dark: #2D3748;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    
    --status-novo: #3182CE;
    --status-atendimento: #D69E2E;
    --status-resolvido: #38A169;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    display: flex;
    height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-dark);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 36px;
}

.sidebar-nav {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: #F0FFF4;
    color: var(--primary-color);
}

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

.btn-new-ticket {
    margin-top: 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-new-ticket:hover {
    background-color: var(--primary-hover);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    height: 70px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-color);
    padding: 10px 16px;
    border-radius: 8px;
    width: 300px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
}

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

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

.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-muted); }

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

/* Container & Dashboard */
.container {
    padding: 40px;
}

.page-title {
    font-size: 24px;
    margin-bottom: 24px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
}

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

.kpi-card.green .kpi-icon { background: #F0FFF4; color: var(--primary-color); }
.kpi-card.blue .kpi-icon { background: #EBF8FF; color: #3182CE; }
.kpi-card.orange .kpi-icon { background: #FFFFF0; color: #D69E2E; }

.kpi-info h3 { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

/* Tickets Table */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
}

.table-container {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.tickets-table th {
    background: #F8FAFC;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.tickets-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.tickets-table td span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.status-novo { background: #EBF8FF; color: var(--status-novo); }
.status-badge.status-atendimento { background: #FFFFF0; color: var(--status-atendimento); }
.status-badge.status-resolvido { background: #F0FFF4; color: var(--status-resolvido); }

.priority-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.p-alta { background: #FED7D7; color: #E53E3E; }
.p-media { background: #FEEBC8; color: #DD6B20; }
.p-baixa { background: #E2E8F0; color: #718096; }

.btn-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}
.btn-action:hover { color: var(--primary-color); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    top: 16px; right: 24px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
}

.btn-submit {
    margin-top: 24px;
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
}
.btn-submit:hover { background: var(--primary-hover); }

/* --- Logout Button --- */
.btn-logout {
    background: #FFF5F5;
    color: #E53E3E;
    border: 1px solid #FED7D7;
    width: 40px; height: 40px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.btn-logout:hover { background: #FED7D7; }

/* --- Login Page Styles --- */
.login-body {
    display: flex;
    align-items: center; justify-content: center;
    background-color: #E2E8F0;
}

.login-container {
    display: flex;
    width: 900px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 60px 40px;
    display: flex; flex-direction: column; justify-content: center;
}

.login-branding {
    font-size: 32px; font-weight: 700;
    display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}

.login-left h2 { font-size: 28px; line-height: 1.3; margin-bottom: 16px; }
.login-left p { color: #C6F6D5; font-size: 15px; line-height: 1.5; }

.login-right {
    flex: 1.2;
    padding: 60px 50px;
    display: flex; flex-direction: column; justify-content: center;
}

.login-form-wrapper h3 { font-size: 26px; color: var(--text-dark); margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

.login-options { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-top: 16px;}
.remember-me { color: var(--text-dark); }
.forgot-pwd { color: var(--primary-color); text-decoration: none; font-weight: 500; }

.btn-login { margin-top: 32px; }

/* --- Customização do Atendimento de Chamado --- */
.ticket-detail-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 16px; border-bottom: 1px solid var(--border-color);
}
.ticket-info-bar {
    background: #F7FAFC; padding: 12px 16px; margin-top: 16px;
    border-radius: 8px; font-size: 14px;
}
.ticket-history {
    background: white; border: 1px solid var(--border-color);
    padding: 24px; border-radius: 12px; margin-top: 24px;
}
.interaction-msg {
    border-left: 3px solid var(--primary-color);
    padding-left: 16px; margin-bottom: 24px;
}
.msg-header { margin-bottom: 8px; font-size: 14px; }
.msg-time { color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.msg-body { font-size: 15px; line-height: 1.5; }
.file-attachment {
    display: inline-block; margin-top: 12px; padding: 8px 12px;
    background: #EDF2F7; border-radius: 6px; font-size: 13px; color: var(--text-dark);
    text-decoration: none; transition: background 0.2s, color 0.2s;
    cursor: pointer; border: 1px solid transparent;
}
.file-attachment:hover {
    background: var(--primary-color); color: white;
}
.ticket-reply-box {
    margin-top: 24px; background: white; padding: 24px;
    border: 1px solid var(--border-color); border-radius: 12px;
}
.ticket-reply-box h3 { margin-bottom: 16px; font-size: 18px; }
.btn-voltar {
    background: white; border: 1px solid var(--border-color);
    padding: 8px 16px; border-radius: 6px; cursor: pointer;
    font-weight: 500; font-size: 14px; color: var(--text-dark);
}
.btn-voltar:hover { background: #EDF2F7; }

/* --- Menu Toggle & Overlay --- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
}

/* --- Responsividade (Modo Mobile) --- */
@media (max-width: 992px) {
    .menu-toggle { display: block; }
    .mobile-close-btn { display: block; }

    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

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

    .sidebar.open + .sidebar-overlay {
        display: block;
    }
    
    body.menu-open .sidebar-overlay {
        display: block;
    }

    .topbar { padding: 0 20px; }
    .search-bar { width: 100%; max-width: 200px; }
}

@media (max-width: 768px) {
    body { flex-direction: column; height: auto; }
    
    .main-content { height: 100vh; overflow-y: auto; }

    .topbar { 
        height: auto; 
        padding: 16px 20px; 
        flex-direction: column; 
        gap: 16px; 
        align-items: stretch;
    }
    
    .topbar > div { justify-content: space-between; }
    .search-bar { max-width: none; flex: 1; }
    
    .user-profile { justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 16px; }

    .container { padding: 20px; }
    .page-title { font-size: 20px; }

    .kpi-grid { grid-template-columns: 1fr; gap: 16px; }
    
    /* Correções de Tabelas no Mobile (Scroll horizontal) */
    .table-container { border-radius: 8px; }
    .tickets-table { min-width: 700px; }
    
    /* Ajuste de formulários e views paralelos */
    .modal-content { width: 95%; padding: 20px; }
    
    .ticket-info-bar span { display: block; padding: 4px 0; }
    .ticket-detail-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    
    /* Login Mobile */
    .login-container { width: 95%; height: auto; flex-direction: column; margin: 20px; }
    .login-left, .login-right { padding: 32px 24px; }
}

