@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-glow: rgba(16, 185, 129, 0.25);
    
    --accent: #0284c7;
    --accent-light: #e0f2fe;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #8b5cf6;
    --purple-light: #f3e8ff;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* NAVBAR */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px var(--primary-glow);
}

.menu-toggle {
    display: none;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
    cursor: pointer;
    color: var(--text-main);
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover, .menu-toggle.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 700;
}

/* MAIN CONTAINER */
.container {
    max-width: 1240px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1;
}

/* HERO / HEADER SECTION */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }

.stat-val {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-secondary {
    background: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-main);
    border-color: #cbd5e1;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
}

/* TABLES */
.table-container {
    overflow-x: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}

.table th {
    background: #f8fafc;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--accent-light); color: var(--accent); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* FORMS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.95rem;
    font-size: 0.92rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* MODAL (Sem backdrop por padrão) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    backdrop-filter: none;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    pointer-events: none;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-color);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease-out;
    pointer-events: auto;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f8fafc;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

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

/* FOOTER */
.footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* NAVBAR USER SESSION */
.user-session-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
}

.btn-white {
    background: #ffffff;
    color: #059669;
    font-weight: 800;
}

.btn-white:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-lg {
    padding: 0.85rem 1.6rem;
    font-size: 1.05rem;
    font-weight: 700;
}

/* =========================================
   LOGIN PAGE STYLES
   ========================================= */
.login-body {
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 50%, #f8fafc 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    padding: 2.25rem 2rem;
    animation: modalIn 0.3s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

/* =========================================
   INSTITUTIONAL / LANDING PAGE STYLES
   ========================================= */
.landing-body {
    background-color: #ffffff;
}

.landing-nav {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}

.hero-section {
    background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.12), transparent 45%),
                radial-gradient(circle at bottom left, rgba(2, 132, 199, 0.08), transparent 40%),
                #ffffff;
    padding: 5rem 1.5rem 4rem;
    border-bottom: 1px solid var(--border-subtle);
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 3.5rem;
    align-items: center;
}

.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    margin-bottom: 1.25rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: #0f172a;
    margin-bottom: 1.25rem;
}

.hero-description {
    font-size: 1.1rem;
    color: #475569;
    line-height: 1.65;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.hero-stats-row {
    display: flex;
    gap: 2rem;
    padding-top: 1.75rem;
    border-top: 1px solid #e2e8f0;
}

.hero-stat-item {
    display: flex;
    flex-direction: column;
}

.hero-stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.hero-stat-text {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}

.hero-card-preview {
    position: relative;
}

.preview-glass-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.12);
    position: relative;
}

.preview-glass-card::before {
    content: "";
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(2, 132, 199, 0.2));
    border-radius: calc(var(--radius-lg) + 8px);
    z-index: -1;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.preview-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.preview-pill-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-pill {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
}

.preview-pill.green { background: #ecfdf5; color: #047857; }
.preview-pill.blue { background: #e0f2fe; color: #0369a1; }
.preview-pill.purple { background: #f3e8ff; color: #6b21a8; }
.preview-pill.orange { background: #fef3c7; color: #b45309; }

/* SECTIONS */
.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 1.5rem;
}

.section-header {
    text-align: center;
    max-width: 650px;
    margin: 0 auto 3.5rem;
}

.section-badge {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.section-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.section-subtitle {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.5;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem;
}

.feature-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
}

.feature-icon.green { background: #ecfdf5; }
.feature-icon.blue { background: #e0f2fe; }
.feature-icon.orange { background: #fef3c7; }
.feature-icon.purple { background: #f3e8ff; }

.feature-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.feature-desc {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
}

/* DIFFERENTIALS */
.differentials-section {
    background: #f8fafc;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.diff-item {
    background: #ffffff;
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
}

.diff-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: rgba(16, 185, 129, 0.25);
    margin-bottom: 0.75rem;
}

.diff-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.diff-text {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
}

/* TEAM */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.team-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    text-align: center;
    transition: var(--transition);
}

.team-card:hover {
    box-shadow: var(--shadow-lg);
}

.team-avatar {
    width: 72px;
    height: 72px;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1.25rem;
    box-shadow: var(--shadow-sm);
}

.team-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.team-role {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.team-bio {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.6;
}

/* CTA */
.cta-section {
    padding: 4rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.cta-card {
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #0284c7 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 3.5rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.cta-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.cta-card p {
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.92;
    line-height: 1.6;
}

/* FOOTER LANDING */
.landing-footer {
    background: #0f172a;
    color: #ffffff;
    padding: 4rem 1.5rem 2rem;
    border-top: 1px solid #1e293b;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #f1f5f9;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid #1e293b;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* =========================================
   RESPONSIVIDADE COMPLETA (TABLETS, MOBILE & PWA)
   ========================================= */

@keyframes slideDownNav {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TABLETS LANDSCAPE & PORTRAIT (<= 992px) */
@media (max-width: 992px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .hero-content {
        text-align: center;
    }

    .hero-title {
        font-size: 2.35rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-stats-row {
        justify-content: center;
    }

    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .footer-col:first-child {
        grid-column: span 2;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .calculadora-grid,
    .alimentos-grid,
    .plano-builder-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
}

/* TABLETS PORTRAIT & SMARTPHONES (<= 860px) */
@media (max-width: 860px) {
    .menu-toggle {
        display: flex;
    }

    .nav-container {
        position: relative;
        padding: 0.75rem 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        border-bottom: 2px solid var(--border-color);
        box-shadow: var(--shadow-xl);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.4rem;
        z-index: 100;
        animation: slideDownNav 0.22s ease-out;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        border-radius: var(--radius-sm);
    }

    .user-session-info {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
        margin-top: 0.25rem;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .user-session-info .btn {
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 1rem;
        margin: 1rem auto;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .page-header > div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .card {
        padding: 1.25rem 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }

    .table th, .table td {
        padding: 0.75rem 0.85rem;
        font-size: 0.88rem;
    }

    .modal-content {
        width: 95vw;
        max-width: 95vw;
        max-height: 88vh;
        margin: 0.5rem auto;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* SMARTPHONES PEQUENOS (<= 520px) */
@media (max-width: 520px) {
    .hero-section {
        padding: 3rem 1rem 2.5rem;
    }

    .hero-title {
        font-size: 1.85rem;
        line-height: 1.2;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-stats-row {
        flex-direction: column;
        gap: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-val {
        font-size: 1.6rem;
    }

    .section-container {
        padding: 3rem 1rem;
    }

    .section-title {
        font-size: 1.65rem;
    }

    .cta-card {
        padding: 2.25rem 1.25rem;
    }

    .cta-card h2 {
        font-size: 1.5rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-col:first-child {
        grid-column: span 1;
    }

    /* Otimização de formulários touch */
    .form-control,
    .btn,
    select.form-control {
        min-height: 46px;
        font-size: 16px; /* Evita zoom forçado no iOS Safari */
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }
}

/* PWA STANDALONE & SAFE AREA SUPPORT */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .navbar {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

@media all and (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top, 20px);
    }
}

/* ========================================================
   PÁGINAS DE ERRO PERSONALIZADAS (404, 500, 403, 400)
   ======================================================== */
.error-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: radial-gradient(circle at 50% 20%, #f1fdf7 0%, var(--bg-main) 70%);
}

.error-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 580px;
    width: 100%;
    padding: 3rem 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

.error-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
}

.error-card.error-404::before {
    background: linear-gradient(90deg, #10b981, #059669, #0284c7);
}

.error-card.error-500::before {
    background: linear-gradient(90deg, #ef4444, #dc2626, #b91c1c);
}

.error-card.error-403::before {
    background: linear-gradient(90deg, #f59e0b, #d97706, #b45309);
}

.error-card.error-400::before {
    background: linear-gradient(90deg, #6366f1, #4f46e5, #4338ca);
}

.error-icon-box {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: var(--shadow-md);
}

.error-card.error-404 .error-icon-box {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #a7f3d0;
}

.error-card.error-500 .error-icon-box {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.error-card.error-403 .error-icon-box {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fde68a;
}

.error-card.error-400 .error-icon-box {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.error-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.error-badge-404 {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #a7f3d0;
}

.error-badge-500 {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.error-badge-403 {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fde68a;
}

.error-badge-400 {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.error-code-huge {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
}

.error-card.error-404 .error-code-huge {
    background: linear-gradient(135deg, #059669, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-card.error-500 .error-code-huge {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-card.error-403 .error-code-huge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-card.error-400 .error-code-huge {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.error-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.error-details {
    text-align: left;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.error-details summary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    outline: none;
    user-select: none;
}

.error-details summary:hover {
    color: var(--text-main);
}

.error-details-box {
    margin-top: 0.75rem;
    padding: 0.85rem;
    background: #0f172a;
    color: #f8fafc;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.78rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.error-quick-links {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.error-quick-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin: 0 0.4rem;
}

.error-quick-links a:hover {
    text-decoration: underline;
}