body.index-page {
    background: #ffffff;
      -webkit-filter: grayscale(85%);
      -moz-filter: grayscale(85%);
      -ms-filter: grayscale(85%);
      -o-filter: grayscale(85%);
      filter: gray;
      filter: grayscale(85%);
}

.personnel-portal {
    --portal-primary: #d64545;
    --portal-primary-dark: #a92f34;
    --portal-ink: #1f1835;
    --portal-muted: #706a7c;
    --portal-line: #ece7f7;
    --portal-card: #ffffff;
    --portal-soft: #fdeaea;
    color: var(--portal-ink);
    background: #ffffff;
    font-family: "Noto Sans Thai", sans-serif;
    overflow: hidden;
}

.personnel-portal a {
    color: inherit;
    text-decoration: none;
}

.portal-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.portal-hero {
    position: relative;
    min-height: 230px;
    display: flex;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .88) 46%, rgba(255, 255, 255, .64) 100%),
        url("../img/hero-carousel/npru-49.jpg") center right / cover no-repeat;
    border-bottom: 1px solid #f0ebfb;
}

.portal-hero::before {
    content: "";
    position: absolute;
    inset: auto -12% -58% -12%;
    height: 140px;
    background: rgba(214, 69, 69, .10);
    border-radius: 50% 50% 0 0;
    pointer-events: none;
}

.portal-hero-content {
    position: relative;
    max-width: 760px;
    padding: 20px 0 28px;
    z-index: 1;
}

.portal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(214, 69, 69, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    color: var(--portal-primary-dark);
    font-size: .94rem;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(214, 69, 69, .08);
    backdrop-filter: blur(10px);
}

.portal-hero h1 {
    margin: 10px 0 6px;
    color: var(--portal-ink);
    font-size: clamp(1.85rem, 3.2vw, 3.1rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: 0;
}

.portal-hero p {
    margin: 0 0 12px;
    color: #5f5870;
    font-size: clamp(.98rem, 1.3vw, 1.14rem);
    line-height: 1.6;
}

.portal-search {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 680px;
    padding: 8px;
    border: 1px solid rgba(214, 69, 69, .13);
    border-radius: 24px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 20px 48px rgba(214, 69, 69, .14);
}

.portal-search-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--portal-primary-dark);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(214, 69, 69, .25), #fdeaea);
    font-size: 1.24rem;
}

.portal-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: var(--portal-ink);
    background: transparent;
    font-size: 1.06rem;
}

.portal-search input::placeholder {
    color: #948da4;
}

.portal-search button {
    min-height: 48px;
    padding: 0 24px;
    border: 0;
    border-radius: 17px;
    color: #ffffff;
    background: var(--portal-primary-dark);
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(214, 69, 69, .24);
    transition: transform .2s ease, box-shadow .2s ease;
}

.portal-search button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(214, 69, 69, .30);
}

.keyword-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
    color: #6f6780;
    font-size: .94rem;
}

.keyword-pill {
    border: 0;
    border-radius: 999px;
    padding: 7px 13px;
    color: var(--portal-primary-dark);
    background: rgba(214, 69, 69, .10);
    font-weight: 700;
    transition: background .2s ease, transform .2s ease;
}

.keyword-pill:hover {
    background: rgba(214, 69, 69, .18);
    transform: translateY(-1px);
}

.portal-section {
    padding: 18px 0 0;
}

.portal-panel {
    border: 1px solid var(--portal-line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 16px 42px rgba(37, 26, 75, .08);
    backdrop-filter: blur(12px);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: nowrap;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    min-width: 0;
    color: var(--portal-ink);
    font-size: clamp(1.18rem, 1.8vw, 1.5rem);
    font-weight: 800;
}

.section-title i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--portal-primary-dark);
    background: #fdeaea;
    font-size: 1.05rem;
}

.portal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #e7defd;
    border-radius: 999px;
    color: var(--portal-primary-dark);
    background: #ffffff;
    font-size: .93rem;
    font-weight: 700;
    white-space: nowrap;
    align-self: flex-start;
}

.portal-link:hover {
    color: var(--portal-primary);
    border-color: rgba(214, 69, 69, .42);
}

.popular-panel {
    position: relative;
    z-index: 2;
    margin-top: 0;
    padding: 18px;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 12px;
}

.app-card {
    display: flex;
    min-height: 124px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: #ffffff;
    text-align: center;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.app-card:hover,
.favorite-card:hover,
.category-card:hover {
    transform: translateY(-4px);
    border-color: rgba(214, 69, 69, .42);
    box-shadow: 0 18px 38px rgba(214, 69, 69, .12);
}

.app-icon,
.mini-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 18px;
    color: var(--portal-primary-dark);
    background: linear-gradient(135deg, rgba(214, 69, 69, .30), #fdeaea);
    border: none;
    box-shadow: 0 6px 20px rgba(214, 69, 69, .12);
}

.app-icon {
    width: 78px;
    height: 78px;
    font-size: 3rem;
}

.mini-icon {
    width: 66px;
    height: 66px;
    border-radius: 18px;
    font-size: 2.35rem;
}

.app-icon i,
.mini-icon i,
.section-title i {
    line-height: 1;
}

.app-icon .fa-solid,
.mini-icon .fa-solid {
    color: var(--portal-primary-dark);
    font-size: inherit;
}

.app-card strong,
.favorite-card strong,
.recent-item strong {
    color: var(--portal-ink);
    font-size: 1rem;
    line-height: 1.2;
}

.app-card span {
    color: var(--portal-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.favorite-card span,
.recent-item span {
    color: var(--portal-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.app-card .app-icon {
    width: 78px;
    height: 78px;
    color: var(--portal-primary-dark);
    font-size: 3rem;
    line-height: 1;
    background: linear-gradient(135deg, rgba(214, 69, 69, .30), #fdeaea);
    border: none;
    box-shadow: 0 6px 20px rgba(214, 69, 69, .12);
}

.favorite-card .mini-icon,
.recent-item .mini-icon,
.category-head .mini-icon {
    width: 66px;
    height: 66px;
    color: var(--portal-primary-dark);
    font-size: 2.35rem;
    line-height: 1;
    background: linear-gradient(135deg, rgba(214, 69, 69, .30), #fdeaea);
    border: none;
    box-shadow: 0 6px 20px rgba(214, 69, 69, .12);
}

.portal-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.favorites-panel,
.recent-panel {
    padding: 18px;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.favorite-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 10px 12px;
    border: 1px solid #ece7f5;
    border-radius: 17px;
    background: #ffffff;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.favorite-empty {
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px dashed rgba(214, 69, 69, .32);
    border-radius: 16px;
    color: var(--portal-primary-dark);
    background: #fff2f2;
    text-align: center;
    font-size: .94rem;
    font-weight: 700;
}

.favorite-manage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.favorite-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ece7f5;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.favorite-choice:hover {
    transform: translateY(-2px);
    border-color: rgba(214, 69, 69, .36);
    box-shadow: 0 12px 28px rgba(214, 69, 69, .10);
}

.favorite-choice input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.favorite-choice .choice-star {
    margin-left: auto;
    margin-top: 2px;
    align-self: flex-start;
    color: #d5cdea;
    font-size: .95rem;
    line-height: 1.25;
    transition: color .2s ease, transform .2s ease;
}

.favorite-choice .mini-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 1rem;
}

.favorite-choice-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.favorite-choice strong {
    display: block;
    color: var(--portal-ink);
    font-size: .94rem;
    line-height: 1.15;
}

.favorite-choice span span {
    color: var(--portal-muted);
    font-size: .78rem;
    line-height: 1.15;
}

.favorite-choice:has(input:checked) {
    border-color: rgba(214, 69, 69, .50);
    background: #fff2f2;
}

.favorite-choice:has(input:checked) .choice-star {
    color: var(--portal-primary-dark);
    transform: scale(1.1);
}

.favorite-limit-note {
    color: var(--portal-muted);
    font-size: .92rem;
}

.favorite-modal-body {
    max-height: min(62vh, 620px);
    overflow-y: auto;
}

.recent-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recent-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    border-bottom: 1px solid #f0edf6;
}

.recent-item:last-child {
    border-bottom: 0;
}

.recent-time {
    color: #8a8396;
    font-size: .88rem;
    text-align: right;
    white-space: nowrap;
}

.category-panel {
    padding: 18px;
    margin-bottom: 24px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.category-card {
    --accent: var(--portal-primary);
    --soft: #fdeaea;
    display: flex;
    min-height: 276px;
    flex-direction: column;
    border: 1px solid #ece7f5;
    border-top: 4px solid var(--accent);
    border-radius: 20px;
    background: #ffffff;
    overflow: hidden;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.category-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(90deg, var(--soft), rgba(255, 255, 255, .55));
}

.category-head h3 {
    margin: 0 0 3px;
    color: var(--portal-primary-dark);
    font-size: 1.08rem;
    font-weight: 800;
}

.category-head p {
    margin: 0;
    color: var(--portal-muted);
    font-size: .9rem;
    line-height: 1.55;
}

.category-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 14px 16px 6px;
    list-style: none;
}

.category-list a {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #514a61;
    font-size: .95rem;
    line-height: 1.45;
}

.category-list a::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: 10px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--accent);
    opacity: .56;
}

.category-list a:hover {
    color: var(--accent);
}

.category-actions {
    margin-top: auto;
    padding: 10px 16px 14px;
}

.category-actions .portal-link {
    width: 100%;
    justify-content: center;
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent), transparent 72%);
}

.accent-purple {
    --accent: #d64545;
    --soft: #fdeaea;
}

.accent-orange {
    --accent: #d64545;
    --soft: #fdeaea;
}

.accent-green {
    --accent: #d64545;
    --soft: #fdeaea;
}

.accent-blue {
    --accent: #d64545;
    --soft: #fdeaea;
}

.accent-pink {
    --accent: #d64545;
    --soft: #fdeaea;
}

.accent-teal {
    --accent: #d64545;
    --soft: #fdeaea;
}

.no-results {
    display: none;
    padding: 22px;
    border: 1px dashed rgba(214, 69, 69, .32);
    border-radius: 18px;
    color: var(--portal-muted);
    background: #fff2f2;
    text-align: center;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 1199px) {
    .popular-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .portal-container {
        width: min(100% - 24px, 1180px);
    }

    .portal-hero {
        min-height: auto;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(255, 255, 255, .88)),
            url("assets/img/hero-carousel/npru-49.jpg") center / cover no-repeat;
    }

    .portal-hero-content {
        padding: 22px 0 30px;
    }

    .portal-search {
        align-items: stretch;
        flex-wrap: wrap;
        border-radius: 20px;
    }

    .portal-search-icon {
        width: 42px;
        height: 42px;
    }

    .portal-search input {
        min-height: 42px;
        flex-basis: calc(100% - 58px);
    }

    .portal-search button {
        width: 100%;
    }

    .popular-panel,
    .favorites-panel,
    .recent-panel,
    .category-panel {
        padding: 18px;
        border-radius: 20px;
    }

    .popular-grid,
    .favorites-grid,
    .favorite-manage-grid,
    .category-grid,
    .portal-two-col {
        grid-template-columns: 1fr;
    }

    .app-card {
        min-height: 116px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 14px;
        text-align: left;
    }

    .section-head {
        align-items: center;
        flex-direction: row;
    }

    .portal-link {
        justify-content: center;
        width: auto;
    }

    .section-head .portal-link {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: .86rem;
    }

    .recent-item {
        grid-template-columns: auto 1fr;
    }

    .recent-time {
        grid-column: 2;
        text-align: left;
    }
}