*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: 32px 32px;
    background-image: radial-gradient(circle at center, #cbd5e1 1px, transparent 1px);
    opacity: 0.4;
    z-index: -1;
}

.app-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 1040px;
    height: 100vh;
    margin: 0 auto;
}

.sidebar {
    width: 240px;
    background: transparent;
    border-right: 1px dashed rgba(15, 23, 42, 0.1);
    display: flex;
    flex-direction: column;
    padding: 50px 20px 40px 10px;
    z-index: 50;
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 12px;
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    align-items: flex-start;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    width: 198px;
}

.nav-icon {
    font-size: 20px;
    transition: var(--transition);
}

.nav-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 8px 20px var(--accent-glow);
}

.page-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 50px 20px 50px 40px;
    position: relative;
}

.main-wrapper {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
}

.footer-links {
    margin: 32px auto 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: center;
    column-gap: 40px;
    row-gap: 10px;
    font-size: 13.5px;
    color: var(--text-muted);
    width: 100%;
    padding-bottom: 20px;
    align-items: center;
}

.footer-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    width: auto;
    padding: 0 4px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    body {
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        order: 2;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        padding: 12px 8px;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background: var(--bg-card);
        flex-direction: row;
        justify-content: space-around;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        z-index: 120;
    }

    .sidebar-logo {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        align-items: stretch;
    }

    .nav-item {
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        padding: 8px 12px;
        font-size: 11px;
        border-radius: 10px;
        width: auto;
    }

    .nav-item.active {
        box-shadow: none;
        background: rgba(59, 130, 246, 0.1);
        color: var(--accent);
    }

    .page-content {
        order: 1;
        height: auto;
        min-height: 100vh;
        overflow: visible;
        padding: 24px 16px calc(110px + env(safe-area-inset-bottom));
        align-items: center;
        -webkit-overflow-scrolling: touch;
    }

    .main-wrapper {
        margin: 0 auto;
    }

    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, max-content);
        grid-auto-flow: row;
        justify-content: center;
        column-gap: 20px;
        row-gap: 8px;
        padding-bottom: 40px;
    }

    .footer-links a {
        width: auto;
    }
}
