.app-topbar {
    margin-bottom: 0.6rem;
    margin-top: calc(-1 * env(safe-area-inset-top, 0px) - 1px);
    border: none;
    border-radius: 0 0 0px 0px; /* 0 0 16px 16px; */
    padding: calc(env(safe-area-inset-top, 0px) + 0.44rem + 1px) 0.45rem 0.44rem 0.45rem !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--app-header-bg);
    box-shadow: none;
    gap: 0.35rem;
    min-height: 0;
}

#main-layout {
    background: var(--pico-background-color);
}

#main-content {
    background: var(--pico-background-color) !important;
}

.app-topbar-main {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    min-width: 0;
}

.app-topbar-logo-link {
    display: block;
    line-height: 0;
}

.app-topbar-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 0px solid rgba(255, 255, 255, 0.65);
    background: url('../img/logo.png') center / contain no-repeat;
    flex-shrink: 0;
}

.app-topbar-text {
    min-width: 0;
}

.app-topbar-text strong {
    color: #ffffff;
    display: block;
    font-size: 1.10rem;
    line-height: 0.98;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar-text small {
    color: rgba(255, 255, 255, 0.9);
    display: block;
    margin-top: 0.02rem;
    font-size: 0.80rem;
    line-height: 0.98;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.top-nav-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    text-decoration: none;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
}

.top-nav-link:hover, .top-nav-link:active {
    color: #ffffff;
    text-decoration: none;
}

.top-nav-link i {
    width: 22px;
    height: 22px;
    margin-bottom: 3px;
}

.top-nav-link span {
    font-size: 0.60rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#top-nav,
#top-nav li {
    margin: 0;
    list-style: none;
}

#top-nav {
    padding: 0;
}

#top-nav > li {
    padding: 0 !important;
    display: flex;
    align-items: center;
}

#top-nav details.dropdown {
    display: flex;
    align-items: center;
}

#top-nav details.dropdown summary::after {
    display: none;
}

#top-nav details.dropdown summary {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
}

.app-topbar ul,
.app-topbar li,
.app-topbar summary {
    margin: 0;
}

.app-topbar ul,
.app-topbar li {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#top-nav details.dropdown summary i {
    width: 20px;
    height: 20px;
}

#top-nav details.dropdown ul {
    left: auto;
    right: 0;
}

#top-nav details.dropdown ul li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 340px) {
    .app-topbar-logo {
        width: 28px;
        height: 28px;
    }

    .app-topbar-text strong {
        font-size: 0.9rem;
    }

    .app-topbar-text small {
        font-size: 0.64rem;
    }
}

.grid-dashboard {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 2), 1fr);
    gap: 0.6rem;
    padding: 0.5rem 0;
}

.dashboard-group {
    margin-bottom: 1.0rem;
}

.group-title {
    margin-bottom: 0.4rem !important;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pico-muted-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-bottom: 4px;
}

.card-btn {
    --menu-item-color: var(--pico-primary);
    background: color-mix(in srgb, var(--menu-item-color), transparent 93%);
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    text-decoration: none;
    color: var(--menu-item-color);
    /* Sombra colorida embaixo simulando "3D/botão palpável" + Sombra genérica de profundidade */
    box-shadow: 0 3px 0 color-mix(in srgb, var(--menu-item-color), transparent 80%), 0 4px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 5.5rem;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    border: 1px solid color-mix(in srgb, var(--menu-item-color), transparent 80%);
    position: relative;
}

.card-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card-btn:hover {
    text-decoration: none;
    background: color-mix(in srgb, var(--menu-item-color), transparent 88%);
}

.card-btn:active {
    /* Efeito de ser pressionado na tela (botão afundando) */
    transform: translateY(3px);
    box-shadow: 0 0px 0 color-mix(in srgb, var(--menu-item-color), transparent 80%), 0 2px 3px rgba(0, 0, 0, 0.04);
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--menu-item-color), transparent 90%);
    color: var(--menu-item-color);
}

.card-icon i {
    width: 20px;
    height: 20px;
}

.card-title {
    font-size: 1.0rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    color: var(--menu-item-color);
    margin-bottom: 1px;
}

.card-subtext {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    text-align: center;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0rem;
}

/* Ajuste para telas maiores */
@media (min-width: 768px) {
    .grid-dashboard {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
    }
    
    .card-btn {
        min-height: 5.2rem;
    }
}

/* Ajuste para telas desktop muito largas */
@media (min-width: 1200px) {
    .grid-dashboard {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Ajuste para telas muito pequenas */
@media (max-width: 340px) {
    .grid-dashboard {
        grid-template-columns: 1fr;
    }
}
