:root {
    --primary: #3b82f6;       /* Blue-500 */
    --primary-hover: #2563eb; /* Blue-600 */
    --text-main: #1e293b;     /* Slate-800 */
    --text-muted: #94a3b8;    /* Slate-400 */
    --border: #e2e8f0;        /* Slate-200 */
    --bg-input: #ffffff;
    --bg-disabled: #f8fafc;
    --radius: 0.5rem;         /* 8px */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   1. Configurações Globais & Scrollbar
   ========================================= */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #334155;
    overflow: hidden; /* App-like feel */
}

/* Scrollbar Sutil */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =========================================
   2. Estrutura de Views (SPA)
   ========================================= */
/* Customização da Tela de Login */
#login-view {
    /* Centralização absoluta */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Garante que ocupe a tela toda */
    width: 100vw;
    height: 100vh;
}

/* Quando o JS adicionar a classe hidden, ela DEVE prevalecer */
#login-view.hidden {
    display: none !important;
}

#login-view .form-control-modern {
    background-color: #f8fafc;
    border-color: #f1f5f9;
}

#login-view .form-control-modern:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Animação suave de entrada para o card */
.animate-card {
    animation: loginScaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginScaleUp {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

#app-view { display: none; height: 100vh; }

.view-section {
    display: none;
    animation: slideUpFade 0.3s ease-out;
}
.view-section.active { display: block; }

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Remova o !important. O controle de quem é admin deve ser feito via JS */
.admin-only { 
    display: none; 
}

/* =========================================
   3. Componentes de Formulário (Inputs Modernos)
   ========================================= */
.input-icon-wrapper {
    position: relative;
    width: 100%;
}

.input-icon-wrapper i {
    position: absolute; left: 1rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.form-control-modern {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius);
    padding: 0.625rem 1rem 0.625rem 2.5rem; /* Padding left p/ ícone */
    font-size: 0.875rem;
    transition: var(--transition);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Estados de Foco */
.form-control-modern:focus,
.input-icon-wrapper input:focus ~ i,
.input-icon-wrapper select:focus ~ i {
    outline: none;
    border-color: var(--primary);
    color: var(--primary);
}
.form-control-modern:focus {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control-modern:disabled {
    background-color: var(--bg-disabled);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Select Customizado (Seta SVG) */
select.form-control-modern {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Fix Date Input iOS */
input[type="date"] { -webkit-appearance: none; min-height: 2.5rem; }

/* Botões de Filtro (Quadrados com ícone) */
.btn-filter-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}
.btn-filter-icon:hover { transform: translateY(-1px); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* =========================================
   4. Sidebar e Navegação
   ========================================= */
#sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--border);
}

.nav-item {
    display: flex; align-items: center;
    width: 92%; margin-left: 4%; margin-bottom: 2px;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem; font-weight: 500;
    color: #64748b;
    border-radius: var(--radius);
    transition: var(--transition);
    text-decoration: none;
}

.nav-item i {
    width: 1.5rem; margin-right: 0.75rem; text-align: center;
    font-size: 1rem; color: var(--text-muted); transition: color 0.2s;
}

.nav-item:hover { background-color: #f1f5f9; color: #0f172a; }
.nav-item:hover i { color: #475569; }

.nav-item.active { background-color: #eff6ff; color: var(--primary-hover); font-weight: 600; }
.nav-item.active i { color: var(--primary-hover); }

/* =========================================
   5. Checklist Diário (Botões Grandes)
   ========================================= */
.chk-btn-modern {
    display: flex; align-items: center; gap: 0.75rem;
    width: 100%; padding: 0.5rem 0.75rem;
    background-color: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #64748b;
    font-size: 0.85rem; font-weight: 500;
    transition: var(--transition);
}

.chk-btn-modern:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.chk-icon { width: 1.5rem; text-align: center; color: var(--text-muted); transition: color 0.2s; }
.chk-state { font-size: 1.1rem; color: #cbd5e1; transition: all 0.3s; }

/* Estado Concluído */
.chk-btn-modern.completed {
    background-color: #f0fdf4; /* Green-50 */
    border-color: #bbf7d0;     /* Green-200 */
    color: #166534;            /* Green-800 */
}
.chk-btn-modern.completed .chk-icon { color: #22c55e; }
.chk-btn-modern.completed .chk-state { color: #16a34a; transform: scale(1.1); }
.chk-btn-modern.disabled { opacity: 0.6; cursor: not-allowed; }

/* =========================================
   6. Toasts (Notificações Flutuantes)
   ========================================= */
#toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: 99999;
    display: flex; flex-direction: column; gap: 0.75rem;
    width: auto; max-width: 100%;
}
@media (min-width: 640px) {
    #toast-container { right: 1.5rem; max-width: 24rem; }
}

.toast-item {
    background: white; padding: 1rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-left: 4px solid;
    display: flex; align-items: center; gap: 0.75rem;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-item.show { transform: translateX(0); }

.toast-success { border-color: #22c55e; } .toast-success i { color: #22c55e; }
.toast-error { border-color: #ef4444; }   .toast-error i { color: #ef4444; }
.toast-warning { border-color: #eab308; } .toast-warning i { color: #eab308; }

/* Utilitários Extras */
.overflow-x-auto { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

.animate-fade {
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}