.flex-grow-1 {
    min-width: 0;
}

main.container-fluid,
.container-fluid,
.container,
.page-content-wrap {
    position: relative;
    z-index: auto;
}

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

.ondblclick[ondblclick] {
    cursor: pointer;
}

/* App shell */
.app-shell {
    display: flex;
    position: relative;
    align-items: flex-start;
    gap: 0;
    /* width: 100%; */
}

.page-content-wrap {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1rem 1rem 1.5rem 0;
}


/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    margin: 1rem;
    height: calc(100vh - 2rem);
    position: sticky;
    top: 1rem;
    flex-shrink: 0;
    border-radius: 24px;
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    z-index: var(--z-sidebar);
    transition: width var(--transition-base), min-width var(--transition-base), transform var(--transition-base);
}

.app-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.12), transparent 28%),
        radial-gradient(circle at 92% 18%, rgba(var(--accent-rgb), 0.14), transparent 24%);
    pointer-events: none;
}

.app-sidebar > * {
    position: relative;
    z-index: 1;
}

.sidebar-top,
.sidebar-footer {
    flex-shrink: 0;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 54px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 0.15rem;
    margin-top: 0.75rem;
}

.sidebar-body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body.sidebar-collapsed .sidebar-body {
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.brand-text strong {
    color: #fff;
    font-size: 0.9rem;
}

.brand-text strong,
.brand-text small,
.sidebar-user-meta strong,
.sidebar-user-meta small,
.sidebar-link-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-text small,
.sidebar-user-meta small {
    color: var(--sidebar-muted);
}

.sidebar-toggle,
.sidebar-mobile-toggle,
.sidebar-theme-btn {
    border: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.sidebar-mobile-toggle {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    width: 52px;
    height: 52px;
    box-shadow: var(--shadow-soft);
    background: var(--brand-color);
    z-index: var(--z-mobile-toggle);
}

.sidebar-theme-btn {
    width: 100%;
    padding: 0.75rem 0.9rem;
    justify-content: flex-start;
    font-weight: 700;
}

.sidebar-toggle:hover,
.sidebar-theme-btn:hover,
.sidebar-mobile-toggle:hover {
    background: rgba(var(--brand-rgb), 0.30);
    transform: translateY(-1px);
}

.sidebar-toggle:focus-visible,
.sidebar-theme-btn:focus-visible,
.sidebar-mobile-toggle:focus-visible,
.sidebar-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 2px;
}

.sidebar-search {
    margin-top: 1rem;
}

.sidebar-search-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 0.72rem 0.9rem;
}

.sidebar-search-box i {
    color: var(--sidebar-muted);
}

.sidebar-search-box input {
    background: transparent;
    border: 0;
    outline: 0;
    color: #fff;
    width: 100%;
    font-size: var(--font-base);
}

.sidebar-search-box input::placeholder {
    color: var(--sidebar-muted);
}

.sidebar-group {
    margin-bottom: 1rem;
}

.sidebar-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
    margin-bottom: 0.7rem;
    padding: 0 0.4rem;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 15px;
    padding: 0.76rem 0.85rem;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    min-height: 42px;
}

.sidebar-link:hover {
    background: var(--sidebar-link-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: var(--sidebar-link-active);
    color: #fff;
    box-shadow: 0 10px 25px rgba(var(--brand-rgb), 0.35);
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
}

.sidebar-link-icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-link-text {
    font-size: 0.88rem;
    font-weight: 500;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.85rem;
    padding: 0.8rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #006546, #0b8a61);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-search,
body.sidebar-collapsed .sidebar-group-title,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .sidebar-theme-btn span,
body.sidebar-collapsed .sidebar-user-meta {
    display: none !important;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-user-card,
body.sidebar-collapsed .sidebar-theme-btn,
body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-link {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body.sidebar-collapsed .sidebar-link.active::before {
    left: 8px;
}

body.sidebar-collapsed .sidebar-toggle {
    display: inline-flex !important;
    margin: 0 auto;
}
