/* --- VARIÁVEIS E RESET --- */
:root {
    --primary: #000000;
    --accent: #0066cc;
    --accent-hover: #005bb5;
    --text-main: #1d1d1f;
    --text-muted: #515154;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9500;
    
    /* Valores maiores para deixar tudo bem redondo */
    --radius-lg: 32px; 
    --radius-md: 16px; 
    --border-color: #e5e7eb;
}

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

body { 
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; 
    color: var(--text-main); 
    background-color: #f4f4f5; 
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,77%,0.4) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,80%,0.4) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,85%,0.4) 0, transparent 50%);
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
}

.text-danger { 
    color: var(--danger) !important; 
}

.text-warning { 
    color: var(--warning) !important; 
}

/* --- TELA DE LOGIN --- */
#login-container { 
    height: 100vh; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
}

.login-wrapper { 
    display: flex; 
    border-radius: var(--radius-lg); 
    overflow: hidden; 
    width: 100%; 
    max-width: 1000px; 
    min-height: 500px; 
    background: #ffffff; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.08); 
}

.login-image-side { 
    flex: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 3rem; 
    background: #fafafa; 
    border-right: 1px solid var(--border-color); 
}

.logo-large { 
    max-width: 440px; 
    height: auto; 
    object-fit: contain; 
}

.login-form-side { 
    flex: 1; 
    padding: 4rem; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
}

.login-form-side h2 { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 2rem; 
    margin-bottom: 0.5rem; 
    letter-spacing: -0.5px; 
    white-space: nowrap; 
}

.subtitle { 
    color: var(--text-muted); 
    margin-bottom: 2.5rem; 
    font-size: 1.1rem; 
}

.login-input-group { 
    margin-bottom: 1.5rem; 
}

.login-input-group label { 
    display: block; 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: var(--text-muted); 
    margin-bottom: 0.5rem; 
}

.login-input-group input { 
    width: 100%; 
    padding: 1rem 1.2rem; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); 
    background: #f9fafb; 
    outline: none; 
    transition: 0.3s; 
    font-family: inherit; 
    font-size: 1rem; 
}

.login-input-group input:focus { 
    border-color: var(--accent); 
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1); 
    background: #fff; 
}

.btn-login { 
    background-color: var(--primary); 
    color: white; 
    width: 100%; 
    padding: 1rem; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    font-size: 1rem; 
    cursor: pointer; 
    border: none; 
    transition: 0.2s; 
    margin-top: 1rem; 
}

.btn-login:hover { 
    background-color: #333; 
    transform: scale(1.02); 
}

.error-msg { 
    color: var(--danger); 
    margin-top: 1rem; 
    font-size: 0.85rem; 
    text-align: center; 
}

@media (max-width: 768px) { 
    .login-image-side { 
        display: none; 
    } 
    .login-form-side { 
        padding: 2rem; 
    } 
}

/* --- HEADER PRINCIPAL --- */
#app-container { 
    display: none; 
    flex-direction: column; 
    min-height: 100vh; 
}

.main-header { 
    background: #ffffff; 
    padding: 1rem 3%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-color); 
    position: sticky; 
    top: 0; 
    z-index: 10; 
}

.logo-text { 
    font-weight: 800; 
    font-size: 1.5rem; 
    letter-spacing: -0.5px; 
}

.logo-text span { 
    color: var(--accent); 
}

.btn-icon-text { 
    background: transparent; 
    border: none; 
    font-family: inherit; 
    font-weight: 600; 
    color: var(--text-muted); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 8px 16px; 
    border-radius: var(--radius-md); 
    transition: 0.2s; 
}

.btn-icon-text:hover { 
    background: #f3f4f6; 
    color: var(--text-main); 
}

.dashboard-layout { 
    display: flex; 
    align-items: flex-start; 
    width: 100%; 
}

/* --- BARRA LATERAL --- */
.sidebar-categorias { 
    width: 280px; 
    padding: 2rem 1.5rem; 
    min-height: calc(100vh - 70px); 
    position: sticky; 
    top: 70px; 
    display: flex; 
    flex-direction: column; 
    margin-right: 2rem; 
    background: #ffffff; 
    border-right: 1px solid var(--border-color); 
}

.sidebar-header { 
    text-align: center; 
    margin-bottom: 2rem; 
    padding-bottom: 1.5rem; 
    border-bottom: 1px solid var(--border-color); /* LINHA ADICIONADA AQUI */
}

.sidebar-logo { 
    max-width: 100px; 
    margin-bottom: 1rem; 
}

.sidebar-desc { 
    font-size: 0.8rem; 
    color: var(--text-muted); 
    line-height: 1.5; 
}

.sidebar-categorias h3 { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    margin-bottom: 1rem; 
    padding-left: 0.8rem; 
    font-weight: 700; 
}

.sidebar-categorias ul { 
    list-style: none; 
}

.sidebar-categorias li { 
    padding: 0.9rem 1rem; 
    margin-bottom: 0.3rem; 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    font-weight: 600; 
    color: var(--text-muted); 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    transition: all 0.3s ease; 
}

.sidebar-categorias li i { 
    font-size: 1.25rem; 
}

.sidebar-categorias li:hover { 
    background: #f9fafb; 
    color: var(--text-main); 
}

.sidebar-categorias li.active { 
    background: var(--primary); 
    color: white; 
}

.sidebar-footer { 
    margin-top: auto; 
    text-align: center; 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    font-weight: 600; 
    padding-top: 1.5rem; 
    border-top: 1px solid var(--border-color); /* LINHA ADICIONADA AQUI */
}

/* --- CONTEÚDO PRINCIPAL --- */
main { 
    flex: 1; 
    padding: 2rem 2rem 2rem 0; 
    display: flex; 
    flex-direction: column; 
    max-width: 1400px; 
}

.page-title { 
    margin-bottom: 1.5rem; 
    font-size: 2rem; 
    letter-spacing: -0.5px; 
    color: var(--text-main); 
}

/* Início */
.welcome-title { 
    font-size: 1.5rem; 
    margin-bottom: 1rem; 
}

.welcome-text { 
    color: var(--text-muted); 
    line-height: 1.6; 
    margin-bottom: 1.5rem; 
    font-size: 1.05rem; 
}

.welcome-list { 
    list-style: none; 
    color: var(--text-muted); 
    line-height: 2; 
    font-size: 1rem; 
}

.welcome-list li { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 0.5rem; 
}

.welcome-list i { 
    color: var(--accent); 
    font-size: 1.25rem; 
}

/* Cards de Estatísticas e Tabela */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 1.5rem; 
    margin-bottom: 2rem; 
}

.stat-card { 
    background: #ffffff; 
    padding: 1.5rem; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    cursor: pointer; 
    transition: 0.3s ease; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.02); 
}

.stat-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 8px 16px rgba(0,0,0,0.04); 
}

.stat-card.active { 
    border-color: var(--accent); 
}

.stat-card .label { 
    font-size: 0.85rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.stat-card .label i { 
    font-size: 1.25rem; 
}

.stat-card .value { 
    font-size: 2.5rem; 
    font-weight: 800; 
    display: block; 
    margin-top: 0.5rem; 
    letter-spacing: -1px; 
}

/* Tabela Container */
.content-box { 
    background: #ffffff; 
    padding: 1.5rem; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.02); 
}

.top-bar { 
    display: flex; 
    justify-content: space-between; 
    gap: 1rem; 
    margin-bottom: 1.5rem; 
    flex-wrap: wrap; 
}

.search-wrapper { 
    position: relative; 
    flex: 1; 
    min-width: 250px; 
}

.search-icon { 
    position: absolute; 
    left: 1rem; 
    top: 50%; 
    transform: translateY(-50%); 
    color: var(--text-muted); 
    font-size: 1.2rem; 
}

.search-table { 
    width: 100%; 
    padding: 0.8rem 1.2rem; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); 
    background: #f9fafb; 
    outline: none; 
    transition: 0.3s; 
    font-family: inherit; 
    font-size: 0.95rem; 
}

.search-table:focus { 
    background: white; 
    border-color: var(--accent); 
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1); 
}

.search-wrapper .search-table { 
    padding-left: 2.8rem; 
}

select.search-table { 
    padding-left: 1.2rem; 
    cursor: pointer; 
    appearance: none; 
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); 
    background-repeat: no-repeat; 
    background-position: right 1rem center; 
    background-size: 1em; 
}

.btn-primary { 
    background: var(--accent); 
    color: white; 
    padding: 0.8rem 1.5rem; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    cursor: pointer; 
    border: none; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.btn-primary:hover { 
    background: var(--accent-hover); 
    transform: scale(1.02); 
}

.btn-secondary { 
    background: #f3f4f6; 
    color: var(--text-main); 
    padding: 0.8rem 1.5rem; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    cursor: pointer; 
    border: none; 
    transition: 0.2s; 
}

.btn-secondary:hover { 
    background: #e5e7eb; 
}

.table-responsive { 
    overflow-x: auto; 
}

table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
}

th { 
    text-align: left; 
    padding: 1rem; 
    color: var(--text-muted); 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    font-weight: 700; 
    letter-spacing: 0.05em; 
    border-bottom: 1px solid var(--border-color); 
}

td { 
    padding: 1rem; 
    border-bottom: 1px solid var(--border-color); 
    font-size: 0.95rem; 
    vertical-align: middle; 
}

tr:last-child td { 
    border-bottom: none; 
}

tr:hover td { 
    background: #f9fafb; 
}

.badge { 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 0.75rem; 
    font-weight: 700; 
    display: inline-block; 
}

.status-atrasado { 
    background: #fee2e2; 
    color: var(--danger); 
}

.status-hoje { 
    background: #fef3c7; 
    color: var(--warning); 
}

.status-dia { 
    background: #dcfce7; 
    color: var(--success); 
}

.action-buttons { 
    display: flex; 
    justify-content: flex-end; 
    gap: 8px; 
}

.btn-icon { 
    background: transparent; 
    border: none; 
    font-size: 1.25rem; 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 8px; 
    transition: 0.2s ease; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

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

.btn-edit:hover { 
    background: #eff6ff; 
    color: var(--accent); 
}

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

.btn-delete:hover { 
    background: #fef2f2; 
    color: var(--danger); 
}

/* --- MODAL --- */
.modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.4); 
    z-index: 1000; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
}

.modal-content { 
    background: #ffffff; 
    border-radius: var(--radius-lg); 
    width: 100%; 
    max-width: 600px; 
    padding: 2.5rem; 
    box-shadow: 0 24px 48px rgba(0,0,0,0.1); 
}

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

.modal-header h2 { 
    font-size: 1.5rem; 
    letter-spacing: -0.5px; 
}

.btn-close { 
    background: transparent; 
    border: none; 
    font-size: 1.5rem; 
    color: var(--text-muted); 
    cursor: pointer; 
    transition: 0.2s; 
    border-radius: 50%; 
    width: 36px; 
    height: 36px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.btn-close:hover { 
    background: #f3f4f6; 
    color: var(--text-main); 
}

.input-group { 
    margin-bottom: 1.5rem; 
}

.input-group label { 
    display: block; 
    font-size: 0.85rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    margin-bottom: 0.5rem; 
}

.input-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 1.5rem; 
}

.modal-actions { 
    display: flex; 
    gap: 1rem; 
    justify-content: flex-end; 
    margin-top: 2rem; 
}

/* --- TELA DE CONFIGURAÇÕES --- */
.config-tabs { 
    display: flex; 
    gap: 1rem; 
    margin-bottom: 2rem; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 1rem; 
    overflow-x: auto;
}

.btn-tab { 
    background: transparent; 
    border: none; 
    padding: 0.8rem 1.5rem; 
    font-size: 1rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    cursor: pointer; 
    border-radius: var(--radius-md); 
    transition: 0.3s; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    white-space: nowrap;
}

.btn-tab:hover { 
    background: #f3f4f6; 
    color: var(--text-main); 
}

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

@media (max-width: 1024px) {
    .dashboard-layout { 
        flex-direction: column; 
    }
    .sidebar-categorias { 
        width: 100%; 
        min-height: auto; 
        position: static; 
        border-radius: var(--radius-lg); 
        margin-bottom: 2rem; 
        margin-right: 0; 
        border-right: none; 
    }
    main { 
        padding: 0 1rem 2rem 1rem; 
    }
}