:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #fbbf24;
    --border: #e5e7eb;
    --text-dark: #111827;

    --shadow-card: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-elevated: 0 4px 20px rgba(0,0,0,0.05);
    --radius-card: 12px;
    --radius-lg: 16px;
}

/* === MENSAGENS (django.contrib.messages) === */
.messages-container {
    position: fixed;
    top: 70px; left: 0; right: 0;
    z-index: 1100;
    display: flex; flex-direction: column; gap: 8px;
    padding: 0 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.alert-error, .alert-danger { background-color: var(--danger); }
.alert-success { background-color: var(--success); }
.alert-warning { background-color: var(--warning); color: var(--text-dark); }
.alert-info { background-color: var(--primary); }

/* === BOTÕES DE FILTRO (usado em categorias e relatórios) === */
.filter-btns {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto; /* Permite rolar horizontalmente no celular */
    padding-bottom: 5px;
    /* Esconde barra de rolagem feia */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.filter-btns::-webkit-scrollbar { display: none; }

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: #f9fafb;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

/* === ESTRUTURA GERAL === */
body {
    background-color: var(--bg-body);
    font-family: 'Inter', sans-serif;
    display: block !important;
    margin: 0;
    color: var(--text-main);
    padding-top: 70px; /* Espaço para a barra fixa */
    min-height: 100vh;
}

/* === BARRA DE NAVEGAÇÃO === */
.navbar {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 60px;
    background-color: var(--primary);
    color: white;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.navbar-brand {
    font-weight: 700; font-size: 1.2rem;
    display: flex; align-items: center; gap: 10px;
    color: white; text-decoration: none;
}

.menu-btn {
    background: none; border: none;
    color: white; font-size: 1.5rem;
    cursor: pointer; padding: 5px;
}

/* === MENU LATERAL (SIDEBAR) === */
.sidebar-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000; opacity: 0; visibility: hidden;
    transition: all 0.3s;
}

.sidebar {
    position: fixed; top: 0; right: -280px;
    width: 280px; height: 100%;
    background: white; z-index: 2001;
    transition: right 0.3s ease;
    display: flex; flex-direction: column;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.sidebar.active { right: 0; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar-header {
    background: var(--primary); color: white;
    padding: 20px; height: 60px;
    box-sizing: border-box; font-weight: bold;
    display: flex; justify-content: space-between; align-items: center;
}

.sidebar-menu { list-style: none; padding: 0; margin: 0; }

.sidebar-menu a {
    display: flex; align-items: center;
    padding: 15px 20px; color: #374151;
    text-decoration: none; border-bottom: 1px solid #f3f4f6;
    font-size: 1rem; transition: background 0.2s;
}

.sidebar-menu a i { 
    width: 30px; text-align: center;
    color: var(--primary); margin-right: 10px;
}

.sidebar-menu a:hover { background-color: #f9fafb; }

/* === LAYOUT DE CONTAINER PADRÃO === */
.app-container {
    background-color: var(--bg-card);
    width: 100%; max-width: 600px;
    min-height: calc(100vh - 70px); 
    display: flex; flex-direction: column;
    position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    margin: 0 auto;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 1000px;
        margin-top: 20px; margin-bottom: 20px;
        border-radius: var(--radius-lg);
        min-height: auto;
    }
}

/* === INPUTS GERAIS === */
select, input[type="text"], input[type="number"], input[type="password"], input[type="date"] {
    width: 100%; padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    outline: none; box-sizing: border-box;
    font-size: 1rem;
}

select:focus, input:focus {
    border-color: var(--primary);
}

/* === UTILITÁRIOS === */
.input-readonly {
    background-color: #f3f4f6 !important;
    color: #6b7280;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.btn-primary {
    background: var(--primary); color: white;
    border: none; padding: 12px;
    border-radius: 8px; width: 100%;
    font-weight: 600; cursor: pointer;
    text-align: center; display: block;
    text-decoration: none;
}
.btn-primary:hover { background: var(--primary-hover); }