/* Portal de aplicativos */
.app-shell.portal-shell {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    background: #f4f4f4;
}

body.portal-mode.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
}

.portal-mode .topbar {
    min-height: 40px;
    padding: 0 14px;
    background: var(--primary);
}

.portal-topbar-logo {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    text-decoration: none;
}

.portal-topbar-logo img {
    display: block;
    width: 74px;
    height: auto;
}

.portal-mode .content {
    display: grid;
    min-height: calc(100vh - 40px);
    padding: 0;
    background: #f4f4f4;
}

.portal-modules {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 38px;
    width: 100%;
    padding: 58px 24px 40px;
}

.portal-modules h1 {
    margin: 0;
    color: var(--primary);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.2;
}

.portal-modules-grid {
    display: grid;
    grid-template-columns: repeat(5, 105px);
    gap: 16px;
    justify-content: center;
    width: 100%;
}

.portal-module-card {
    display: grid;
    grid-template-rows: 55px minmax(24px, auto);
    align-items: center;
    justify-items: center;
    gap: 9px;
    width: 105px;
    min-height: 105px;
    padding: 17px 9px 13px;
    border-radius: 3px;
    background: #e6e6e6;
    color: #6c747d;
    text-align: center;
    text-decoration: none;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.portal-module-card:hover {
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 155, 80, 0.14);
    transform: translateY(-2px);
}

.portal-module-card.is-placeholder {
    cursor: default;
}

.portal-module-card.is-placeholder:hover {
    background: #e6e6e6;
    box-shadow: none;
    transform: none;
}

.portal-module-card > span:last-child {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 9px;
    line-height: 1.25;
}

.portal-module-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: #45ad70;
}

.portal-module-icon::before,
.portal-module-icon::after {
    content: "";
    position: absolute;
    border-color: currentColor;
}

.portal-module-icon-acoes {
    border: 3px solid currentColor;
    border-radius: 50%;
}

.portal-module-icon-acoes::before {
    width: 28px;
    height: 3px;
    background: currentColor;
    border: 0;
}

.portal-module-icon-acoes::after {
    width: 3px;
    height: 28px;
    background: currentColor;
    border: 0;
}

.portal-module-icon-mudancas::before {
    width: 30px;
    height: 30px;
    border: 3px solid currentColor;
    border-left-color: transparent;
    border-radius: 50%;
}

.portal-module-icon-mudancas::after {
    right: 5px;
    top: 7px;
    width: 10px;
    height: 10px;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
    transform: rotate(45deg);
}

.portal-module-icon-riscos::before {
    width: 0;
    height: 0;
    border-right: 22px solid transparent;
    border-bottom: 40px solid currentColor;
    border-left: 22px solid transparent;
}

.portal-module-icon-riscos::after {
    content: "!";
    position: relative;
    z-index: 1;
    margin-top: 10px;
    border: 0;
    color: #e6e6e6;
    font-size: 24px;
    font-weight: 800;
}

.portal-module-icon-auditorias::before {
    width: 32px;
    height: 38px;
    border: 3px solid currentColor;
    border-radius: 4px;
}

.portal-module-icon-auditorias::after {
    width: 18px;
    height: 10px;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(40deg);
}

.portal-module-icon-sgi::before {
    width: 30px;
    height: 38px;
    border: 3px solid currentColor;
    border-radius: 4px;
}

.portal-module-icon-sgi::after {
    content: "SGI";
    position: relative;
    margin-top: 14px;
    border: 0;
    font-size: 10px;
    font-weight: 800;
}

@media (max-width: 820px) {
    .portal-modules {
        padding-top: 42px;
    }

    .portal-modules-grid {
        grid-template-columns: repeat(3, 105px);
    }
}

@media (max-width: 420px) {
    .portal-modules-grid {
        grid-template-columns: repeat(2, 105px);
    }
}

@media (max-width: 520px) {
    .topbar-kicker {
        display: none;
    }

    .empty-state h2 {
        font-size: 22px;
    }

    .empty-state p {
        font-size: 15px;
    }
}

/* Modules Grid */
.modules-section {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.modules-header {
    text-align: center;
    margin-bottom: 3rem;
}

.modules-header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.modules-header p {
    color: var(--muted);
    font-size: 1.1rem;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.module-card {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
}

.module-card:hover {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(0, 155, 80, 0.15);
    transform: translateY(-4px);
}

.module-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.module-content h3 {
    font-size: 1.3rem;
    margin: 0.5rem 0;
    color: var(--text);
}

.module-content p {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
}

@media (max-width: 768px) {
    .modules-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .module-card {
        padding: 1.5rem 1rem;
    }

    .module-icon {
        font-size: 2rem;
    }

    .modules-header h1 {
        font-size: 1.8rem;
    }
}

