
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

#pwaModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 10px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #999999ea;
    z-index: 9999;
}

.modal-install-app {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #383838;
    text-align: center;
}

#pwaTitulo {
    font-size: 1.3rem;
}

.btn-install-app {
    display: flex;
    gap: 40px;
}

.btn-install-app button {
    width: 100px;
    padding: 12px 0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#btnInstalar {
    background-color: #3d6cfb;
    color: #ffffff;
}

#btnInstalar:hover {
    background-color: #3d6cfbdf;
}

#btnFecharPwa {
    background-color: #c6c6c6;
}

#btnFecharPwa:hover {
    background-color: #c6c6c6df;
}

.section-heading h2,
.department h3,
.news-card h3 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 25px;
    width: 100%;
    margin: 0 auto;
}

#database-status {
    position: absolute;
    top: 85px;
    left: 45px;
    z-index: 20;
    max-width: 94%;
    margin-right: 18px;
    pointer-events: none;
}

.database-alert {
    display: grid;
    gap: 4px;
    max-height: 85px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0a7a7;
    border-left: 5px solid #c73535;
    border-radius: 8px;
    background: #fff7f7;
    box-shadow: var(--shadow);
    color: #641b1b;
    overflow: hidden;
    pointer-events: auto;
    transform-origin: left center;
    animation: database-alert-grow 0.5s ease-out both;
    transition: width 0.5s ease-in, padding 0.5s ease-in, border-width 0.5s ease-in, opacity 0.1s ease-in;
}

.database-alert-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.icon-alert-close {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--brand-dark);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.icon-alert-close:hover,
.icon-alert-close:focus-visible {
    border-color: rgba(0, 127, 95, 0.45);
    background: var(--surface-muted);
    box-shadow: 0 8px 18px rgba(19, 40, 31, 0.08);
    outline: none;
}

.icon-alert-close span{
    text-align: center;
}

#database-status.htmx-swapping .database-alert {
    width: 0;
    padding-right: 0;
    padding-left: 0;
    border-right-width: 0;
    border-left-width: 0;
    opacity: 0;
}

@keyframes database-alert-grow {
    from {
        width: 0;
        padding-right: 0;
        padding-left: 0;
        border-right-width: 0;
        border-left-width: 0;
        opacity: 0;
    }

    to {
        width: 100%;
        padding-right: 16px;
        padding-left: 16px;
        border-right-width: 1px;
        border-left-width: 5px;
        opacity: 1;
    }
}

.database-alert strong {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.database-alert span {
    color: #7a3434;
    font-size: 0.86rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    animation: database-alert-text-reveal 0.8s ease-out both;
}

@keyframes database-alert-text-reveal {
    0%,
    45% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.apps-panel,
.news-panel {
    min-width: 0;
}

.apps-panel{
    padding: 25px 0 0 48px;
    margin-top: 76px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content:flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h2 {
    font-size: 1.55rem;
}


.department {
    margin-bottom: 30px;
}

.department h3 {
    margin-bottom: 12px;
    color: #25372f;
    font-size: 1.08rem;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.app-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-height: 100px;
    padding: 14px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 18px rgba(19, 40, 31, 0.05);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.compacto{
    min-height: 50px;
    padding: 4px 14px;
}

.app-card:hover,
.app-card:focus-visible {
    border-color: #007f5f73;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.icon-wrap {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 8px;
}

.icon-wrap img {
    display: block;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

.app-card strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.98rem;
}

.app-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.35;
}

.news-panel {
    align-self: start;
    position: sticky;
    top: 0;
    background: #fff;
    border-top: 1px solid #1111117e;
    border-left: 1px solid #1111117e;
    border-bottom: 1px solid #1111117e;
    border-radius: 16px 0 0 16px;
    padding: 25px 13px 25px 25px;
    height: 100vh;
    z-index: 30;
    overflow-y: scroll;

    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: 0.4s ease-in-out;
}

.news-panel:hover {
    scrollbar-color: #afafaf #f1f1f1;
}

/* scrollbar: Chrome, Edge e Safari */
.news-panel::-webkit-scrollbar {
    width: 5px;
}

.news-panel::-webkit-scrollbar-track {
    background: transparent;
}

.news-panel::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 10px;
    transition: 0.4s ease-in-out;
}

.news-panel:hover::-webkit-scrollbar-thumb {
    background: #f1f1f1;
}

.news-panel:hover::-webkit-scrollbar-thumb:hover {
    background: #afafaf;
}

/* ----------------- */

.section-heading.compact {
    margin-bottom: 14px;
}

.news-list {
    display: grid;
    gap: 24px;
}

.news-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 18px rgba(19, 40, 31, 0.07);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.news-card:hover,
.news-card:focus-visible {
    border-color: rgba(0, 127, 95, 0.45);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.news-card[open] {
    box-shadow: var(--shadow);
}

.news-card.featured {
    border-top: 4px solid var(--accent);
}

.news-image {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--surface-muted);
}

.news-summary {
    display: block;
    padding: 0;
    cursor: pointer;
    list-style: none;
}

.news-summary::-webkit-details-marker {
    display: none;
}

.news-summary:focus-visible {
    outline: 3px solid rgba(0, 127, 95, 0.28);
    outline-offset: -3px;
}

.news-summary-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
}

.news-title-wrap {
    min-width: 0;
}

.news-title {
    display: block;
    margin-top: 6px;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.news-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-muted);
}

.news-toggle:hover {
    border-color: rgba(0, 127, 95, 0.45);
}

.news-toggle::before,
.news-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    border-radius: 999px;
    background: var(--brand-dark);
    transform: translate(-50%, -50%);
}

.news-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
    transition: transform 160ms ease;
}

.news-card[open] .news-toggle::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

.news-body {
    padding: 0 16px 16px;
}

.news-tipo {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 700;
}

.news-body time {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 700;
}

.news-card p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.empty-state {
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state p {
    margin-top: 8px;
    color: var(--muted);
}

.empty-state.slim {
    padding: 20px;
}


@media (max-width: 1020px) {
    #database-status {
        left: 20px;
        max-width: 100%;
    }

    .database-alert span {
        white-space: wrap;
        font-size: 12px;
    }

    .page-shell {
        grid-template-columns: 1fr;
    }

    .apps-panel{
        padding: 30px 25px 0 25px;
    }

    .news-panel {
        position: static;
        border-left: none;
        border-bottom: none;
        border-radius: 16px 16px 0 0;
        padding: 25px 25px 25px 25px;
        z-index: 20;
    }
}

@media (max-width: 600px) {
    .section-heading h2 {
        font-size: 1.4rem;
    }

    .app-grid {
        grid-template-columns: 1fr 1fr;
    }

    .app-card {
        display: flex;
        flex-direction: column;
        text-align: center;
        gap: 4px;
        min-height: 95px;
    }

}
