* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2.5rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.info {
    display: flex;
    flex-direction: column;
}

.info .name {
    font-weight: 600;
    font-size: 0.9rem;
}

.info .role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: transparent;
}

#page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.content-container {
    flex: 1;
    padding: 0 2rem 2rem 2rem;
    overflow-y: auto;
}

/* Utilities */
details[open] .chevron {
    transform: rotate(180deg);
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem;
    z-index: 100;
}

.bottom-nav .nav-item {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.bottom-nav .nav-item i {
    width: 20px;
    height: 20px;
}

.bottom-nav .nav-item.active {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .main-content {
        padding-bottom: 70px;
        /* Space for bottom nav */
    }

    .top-bar {
        padding: env(safe-area-inset-top) 1rem 0 1rem;
        height: calc(70px + env(safe-area-inset-top));
    }

    .content-container {
        padding: 0 1rem 1rem 1rem;
    }

    #page-title {
        font-size: 1.25rem;
    }
}

@media print {

    .sidebar,
    .top-bar .actions,
    .btn {
        display: none !important;
    }

    body,
    #app,
    .main-content,
    .content-container {
        display: block !important;
        height: auto !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        background: white !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #eee !important;
        break-inside: avoid;
        margin-bottom: 2rem !important;
    }

    #page-title {
        display: none;
    }

    /* Keep headings visible */
    h2,
    h3 {
        color: black !important;
    }
}

@media print {

    /* Single Entry Printing Mode */
    body.print-single-mode>* {
        display: none !important;
    }

    body.print-single-mode .print-target {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        border: none !important;
    }

    body.print-single-mode .print-target * {
        display: block !important;
    }

    body.print-single-mode .print-target .card-content {
        display: flex !important;
    }
}