:root { 
    --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0; --text: #0f172a; 
    --text-secondary: #64748b; --accent: #2563eb; --success: #10b981; --warn: #f59e0b;
    --card-hover: #f1f5f9;
}
html, body { 
    background: var(--bg); color: var(--text); 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    margin: 0; padding: 0; height: 100%; overflow: hidden;
}
.app-container { 
    max-width: 1400px; margin: 0 auto; padding: 20px; 
    height: 100vh; display: flex; flex-direction: column; box-sizing: border-box;
}
.header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; border-bottom: 1px solid var(--border); 
    padding-bottom: 15px; flex: 0 0 auto;
}
.brand { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--text); }
.nav-btn { 
    background: var(--card); border: 1px solid var(--border); color: var(--text); 
    padding: 8px 16px; border-radius: 6px; text-decoration: none; 
    transition: 0.2s; font-size: 0.9rem; cursor: pointer;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--bg); }
.nav-btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.nav-btn.primary:hover { background: #1d4ed8; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); overflow-y: auto; padding-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: 0.2s; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-color: var(--accent); }

input, select { background: var(--bg); border: 1px solid var(--border); padding: 10px; border-radius: 6px; color: var(--text); width: 100%; box-sizing: border-box; margin-bottom: 10px; }
input:focus { outline: none; border-color: var(--accent); background: var(--card); }
label { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 5px; display: block; }

.badge { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
.b-success { background: #dcfce7; color: #166534; }
.b-warn { background: #fef3c7; color: #92400e; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==============================================================================
   RESPONSIVIDADE MOBILE
   ============================================================================== */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .app-container {
        padding: 12px;
        min-height: 100vh;
        height: auto;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    
    .brand {
        font-size: 1.2rem;
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-bottom: 16px;
    }
    
    .card {
        border-radius: 8px;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-bottom: 16px !important;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Modal responsivo */
    #modal {
        padding: 16px !important;
    }
    
    #modal > div {
        width: calc(100% - 32px) !important;
        max-width: 400px !important;
        padding: 20px !important;
        margin: 0 !important;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
    
    /* Inputs responsivos */
    input, select {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 12px;
    }
    
    label {
        font-size: 0.85rem;
    }
    
    /* Badge ajustado */
    .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

@media screen and (max-width: 480px) {
    .app-container {
        padding: 8px;
    }
    
    .header {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .brand {
        font-size: 1rem;
        gap: 6px;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .grid {
        gap: 8px;
    }
    
    h2 {
        font-size: 1.1rem;
        margin-bottom: 12px !important;
    }
    
    #modal {
        padding: 8px !important;
    }
    
    #modal > div {
        padding: 16px !important;
        margin: 0 !important;
        width: calc(100% - 16px) !important;
    }
    
    /* Garantir que botões no modal fiquem empilhados no mobile pequeno */
    #modal button {
        width: 100% !important;
    }
    
    #modal > div > div:last-of-type {
        flex-direction: column !important;
        gap: 8px !important;
    }
}

