html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main, #f4f6f9);
    -webkit-tap-highlight-color: transparent;
}

.page-wrapper {
    flex: 1 0 auto;
    width: 100%;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .page-wrapper {
        max-width: 1200px;
        padding: 30px 20px;
    }
}

.header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: var(--card-shadow, 0 4px 20px rgba(160, 170, 190, 0.12));
    margin-bottom: 24px;
    overflow: hidden;
}

.header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.header .btn-group {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.header .btn-group::-webkit-scrollbar {
    display: none;
}

.header .btn-group .btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 13px;
}

.header .btn-group .btn.active-nav {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    font-weight: 700;
}

@media (min-width: 768px) {
    .header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 16px 24px;
    }

    .header h2 {
        font-size: 20px;
    }

    .header .btn-group {
        width: auto;
        overflow-x: visible;
        padding-bottom: 0;
    }

    .header .btn-group .btn {
        padding: 9px 16px;
        font-size: 14px;
    }
}

.main-content {
    flex: 1 0 auto;
    width: 100%;
}

.footer {
    flex-shrink: 0;
    background: #ffffff;
    margin-top: 24px;
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--card-shadow, 0 4px 20px rgba(160, 170, 190, 0.12));
    text-align: left;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    line-height: 1.5;
}

.footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.footer-links a {
    color: var(--primary, #2a75d3);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .footer {
        padding: 16px 24px;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}