:root {
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

body {
    min-height: 100vh;
    margin: 0;
}

.topbar {
    min-height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .navbar-brand {
    margin-right: 1rem;
}

.topbar select {
    min-width: 105px;
}

.app-layout {
    min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
}

.main-content {
    min-width: 0;
    padding: 1.5rem;
}

.content-heading {
    margin-bottom: 1.25rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.7rem 0.8rem;
    color: var(--sidebar-text);
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    text-decoration: none;
    font: inherit;
    font-size: 0.95rem;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-submenu {
    margin: 0.25rem 0 0.5rem 1rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--sidebar-border);
}

.submenu-link {
    font-size: 0.9rem;
}

.stat-card {
    height: 100%;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 0.75rem;
    background: var(--stat-icon-bg);
    color: var(--stat-icon-color);
    font-size: 1.25rem;
}

.card {
    border: 1px solid var(--card-border);
    border-radius: 0.85rem;
    box-shadow: 0 0.125rem 0.35rem rgb(0 0 0 / 4%);
}

#app-content[aria-busy="true"] {
    opacity: 0.55;
    pointer-events: none;
}

#invoice-table th {
    white-space: nowrap;
    font-size: 0.875rem;
}

#invoice-table td {
    font-size: 0.9rem;
}


.app-table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    vertical-align: middle;
}

.app-table thead th {
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.app-table tbody td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.app-table tbody tr:last-child td {
    border-bottom: 0;
}

.app-table tbody tr:hover > * {
    --bs-table-bg-state: var(--bs-tertiary-bg);
}

.app-table .table-primary-text {
    font-weight: 600;
    color: var(--bs-emphasis-color);
}

.app-table .table-secondary-text {
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

.app-table .table-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.app-table .table-actions .btn {
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-padding-x: 0.45rem;
}

.app-table-card {
    overflow: hidden;
}

.app-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hide less important columns on mobile */
@media (max-width: 767.98px) {
    .app-table thead th,
    .app-table tbody td {
        padding: 0.75rem 0.65rem;
    }

    .app-table .mobile-compact {
        white-space: nowrap;
    }
}

@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 1rem 0.75rem;
    }

    .content-heading {
        margin-bottom: 1rem;
    }

    .topbar {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}
