/*
 * G안 공통 업무 레이아웃.
 * 헤더·좌측 메뉴·푸터만 꾸민다. 본문용 색상·폰트 변수와 업무별 CSS는 변경하지 않는다.
 * 외곽 배치는 G안 detail.css의 카드형 메뉴 기준을 그대로 사용한다.
 */
.portalShell,
.mainPage {
    --portal-frame-max-width: 1780px;
    --portal-frame-gutter: 32px;
    --portal-sidebar-width: 300px;
    --portal-workspace-gap: 27px;
}

.portalShell {
    display: block;
    min-width: 0;
    background: var(--ui-search-surface);
}

.portalShell > .container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 0;
    background: transparent;
}

.portalShell .shellPageWidth {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    width: calc(100% - var(--portal-frame-gutter) - var(--portal-frame-gutter));
    max-width: var(--portal-frame-max-width);
    margin: 0 auto;
    padding: 22px 0 16px;
}

.portalShell .shellWorkspace {
    display: grid;
    flex: 1 0 auto;
    grid-template-columns: var(--portal-sidebar-width) minmax(0, 1fr);
    gap: var(--portal-workspace-gap);
    align-items: start;
    min-height: 0;
}
.aside-collapsed.portalShell .shellHeaderInner {grid-template-columns: 60px minmax(0, 1fr);}
.aside-collapsed.portalShell .shellWorkspace {grid-template-columns: 60px minmax(0, 1fr);}

.portalShell .shellWorkspace > .subContent {
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.portalShell .subHeader,
.portalShell .subAside,
.portalShell .subFooter {
    --shell-primary: var(--ui-primary);
    --shell-primary-soft: var(--ui-primary-soft);
    --shell-ink: var(--ui-ink);
    --shell-muted: var(--ui-muted);
    --shell-line: var(--ui-line);
    --color-brand: var(--shell-primary);
    --color-brand-font: var(--ui-primary-dark);
    --color-brand-soft: var(--shell-primary-soft);
    --color-text-primary: var(--shell-ink);
    --color-text-secondary: var(--shell-muted);
    --color-border: var(--shell-line);
    --color-border-light: var(--shell-line);
    font-family: var(--font-family-publisher);
    color: var(--shell-ink);
}

.portalShell .subHeader a:focus-visible,
.portalShell .subHeader button:focus-visible,
.portalShell .subAside a:focus-visible,
.portalShell .subAside button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--ui-primary) 55%, var(--ui-white));
    outline-offset: 2px;
}

/* 헤더와 업무 본문이 같은 프레임·좌측 메뉴 폭·간격을 사용한다. 홈도 같은 시작점으로 맞춘다. */
.portalShell > .container > .subHeader {
    flex: 0 0 auto;
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    z-index: 60;
    border-bottom: 1px solid var(--shell-line);
    background: var(--ui-white);
}

.portalShell .shellHeaderInner,
.mainPage .mainHeaderInner {
    display: grid;
    grid-template-columns: var(--portal-sidebar-width) minmax(0, 1fr);
    gap: var(--portal-workspace-gap);
    align-items: center;
    width: calc(100% - var(--portal-frame-gutter) - var(--portal-frame-gutter));
    max-width: var(--portal-frame-max-width);
    min-height: 100px;
    margin: 0 auto;
}

.portalShell .shellHeaderBrand {
    min-width: 0;
}

.portalShell .shellHeaderBrand a {
    display: block;
    width: 210px;
}

.portalShell .shellHeaderBrand img {
    width: 210px;
    height: auto;
    filter: none;
}

/* 메인·로그인과 같은 테마 로고. 접힌 메뉴에서는 기존처럼 왼쪽 심볼만 잘라낸다. */
@supports (mask-image: url("")) or (-webkit-mask-image: url("")) {
    .portalShell .shellHeaderBrand a {position: relative;}
    .portalShell .shellHeaderBrand a::after {
        content: ""; position: absolute; inset: 0;
        background-color: var(--palette-brand-dark); pointer-events: none;
        -webkit-mask: url("../../images/koiha_logo.png") left center / auto 100% no-repeat;
        mask: url("../../images/koiha_logo.png") left center / auto 100% no-repeat;
    }
    .portalShell .shellHeaderBrand img {display: block; opacity: 0;}
}

.portalShell .shellHeaderBrand .styleDummy {
    display: none;
}

.portalShell .shellHeaderContent {
    position: relative;
    min-width: 0;
}

.portalShell .subHeader .headerTop,
.portalShell.aside-collapsed .subHeader .headerTop {
    min-height: 42px;
    height: auto;
    margin-left: 0;
    padding: 6px 0 0;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
}

.portalShell .subHeader .mainSystemTabs {
    gap: 6px;
    padding: 0;
    margin: 0;
}

.portalShell .subHeader .mainSystemTabs > span {
    display: none;
}

.portalShell .subHeader .mainSystemTabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--shell-muted);
    font-size: 14px;
    font-weight: 700;
}

.portalShell .subHeader .mainSystemTabs button._active,
.portalShell .subHeader .mainSystemTabs button:hover {
    border-color: var(--ui-line);
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
}

.portalShell .subHeader .mainSystemTabs button::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--neutral-350);
}

.portalShell .subHeader .mainSystemTabs button._active::before {
    background: currentColor;
}

.portalShell .subHeader .headerBottom {
    height: 58px;
    margin-left: 0;
    padding: 0 132px 0 0;
    gap: 0;
    border: 0;
    background: transparent;
}

.portalShell .subHeader .topMenuWrap {
    gap: 26px;
    padding: 0;
    margin: 0;
}

.portalShell .subHeader .topMenuWrap a {
    display: block;
    position: relative;
    padding: 15px 0;
    color: var(--shell-ink);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.portalShell .subHeader .topMenuWrap a:hover,
.portalShell .subHeader .topMenuWrap a._active {
    color: var(--shell-primary);
}

.portalShell .subHeader .topMenuWrap a._active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -2px;
    left: 0;
    height: 3px;
    border-radius: 2px;
    background: var(--ui-primary);
}

.portalShell .subHeader .menuSet {
    position: absolute;
    right: 0;
    bottom: 16px;
    gap: 14px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--shell-muted);
    font-size: 13px;
}

.portalShell .subHeader .menuSet button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.portalShell .subHeader .topItemWrap {
    position: absolute;
    top: 9px;
    right: 0;
    gap: 12px;
    font-size: 13px;
}

.portalShell .subHeader .topItemWrap button {
    font-size: 13px;
}
.portalShell .subHeader .topItemWrap .admin-btn {
    height: 30px;
    min-height: 30px;
    padding: 0 9px;
    border-color: var(--shell-line);
    background: var(--ui-white);
    color: var(--shell-muted);
    font-size: 12px;
}

.portalShell .subHeader .header-privacy-mask-status {
    min-height: 24px;
    padding: 0 8px;
    border-radius: 5px;
    font-size: 12px;
    line-height: 24px;
}

.portalShell .subHeader .header-privacy-mask[data-unmasked="false"] {
    color: var(--shell-primary);
}

.portalShell .subHeader .header-privacy-mask[data-unmasked="true"] {
    color: var(--ui-danger);
}

.portalShell .subHeader .header-privacy-mask[data-unmasked="false"] .header-privacy-mask-status {
    background: var(--shell-primary);
}

.portalShell .subHeader .header-privacy-mask[data-unmasked="true"] .header-privacy-mask-status {
    background: var(--ui-danger);
}

.portalShell .subHeader .header-ntcn-panel {
    color: var(--shell-ink);
}

.portalShell .subHeader .header-ntcn-list li.is-unread button.header-ntcn-open {
    background: var(--shell-primary-soft);
}

/* 좌측 카드: G안 detail-sidebar / local-navigation과 같은 규격. */
.portalShell .shellWorkspace > .subAside {
    position: static;
    display: block;
    width: auto;
    height: auto;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--ui-line);
    border-radius: 13px;
    overflow: hidden;
    background: var(--ui-white);
    box-shadow: 0 5px 20px color-mix(in srgb, var(--ui-ink) 1.6%, transparent);
    font-family: var(--font-family-base);
    font-size: 16px;
}

.portalShell .shellAsideHeading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 19px 16px 20px;
    border-bottom: 1px solid var(--ui-line-soft);
    background: var(--ui-tab-active);
}

.portalShell .shellAsideTitle {
    min-width: 0;
}

.portalShell .shellAsideHeading h2 {
    margin: 0;
    color: var(--ui-white);
    font-size: 20px;
    font-weight: 750;
    line-height: 1.45;
    word-break: keep-all;
}

.portalShell .subAside .asideController {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--ui-line);
    border-radius: 7px;
    background: var(--ui-white);
    color: var(--neutral-500);
    box-shadow: none;
    transform: none;
}

.portalShell .subAside .asideController::before {
    display: none;
}

.portalShell .subAside .asideController:hover {
    border-color: var(--shell-primary);
    color: var(--shell-primary);
}

.portalShell .shellMenuIcon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.portalShell .subAside .typeName {
    display: none;
}

.portalShell .subAside .menuWrap {
    min-height: 0;
    padding: 12px 9px;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    transform: none;
}

.portalShell .subAside .menuWrap ul {
    gap: 0;
    border: 0;
}

.portalShell .subAside .menuWrap > ul > li {
    margin-bottom: 4px;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.portalShell .subAside .menuWrap .tit {
    min-height: 0;
    padding: 12px 29px 12px 13px;
    border-radius: 7px;
    color: var(--ui-muted);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
}

.portalShell .subAside .menuWrap .tit button {
    min-height: 0;
    padding: 0;
}

.portalShell .subAside .menuWrap .tit:hover {
    background: var(--ui-surface);
    color: var(--shell-primary);
}

.portalShell .subAside .menuWrap li._active > .tit {
    background: var(--ui-surface);
    color: var(--shell-ink);
}

.portalShell .subAside .menuWrap .tit > a {
    display: block;
    width: 100%;
}

/* .portalShell .subAside .menuWrap .shellMenuLink {
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--shell-muted);
    font-weight: 400;
    line-height: 1.65;
} */

.portalShell .subAside .menuWrap li._active > .shellMenuLink {
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
    font-weight: 700;
}

.portalShell .subAside .menuWrap .shellMenuLink::after {
    display: none;
}

.portalShell .subAside .menuWrap .tit::after {
    top: 18px;
    right: 13px;
    width: 5px;
    height: 5px;
    border-color: var(--neutral-400);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.portalShell .subAside .menuWrap li._active > .tit::after {
    top: 21px;
    transform: rotate(225deg);
}

.portalShell .subAside .menuWrap .underTab {
    background: transparent;
    margin: 0;
}

.portalShell .subAside .menuWrap .underTab ol {
    gap: 0;
    padding: 0 0 0 0;
    margin: 5px 9px 10px 9px;
    border-left: 0;
    background: var(--neutral-50);
    border-radius: 0 0 20px 20px;
}

.portalShell .subAside .menuWrap .underTab li {
    border: 0;
    border-radius: 6px;
    color: var(--shell-muted);
    font-size: 15px;
    line-height: 1.65;
}

.portalShell .subAside .menuWrap .underTab li a {
    min-height: 0;
    padding: 9px 10px;
    border-radius: 6px;
    font-weight: 400;
}

.portalShell .subAside .menuWrap .underTab li a:hover {
    background: var(--ui-surface);
    color: var(--shell-primary);
}

.portalShell .subAside .menuWrap .underTab li._active a {
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
    font-weight: 700;
    box-shadow: none;
}

.portalShell .shellCompactNavigation {
    display: none;
}

.portalShell .shellMobileToggle {
    display: none;
}

.portalShell.aside-collapsed {
    --portal-sidebar-width: 300px;
    --portal-workspace-gap: 21px;
}

/* 접힌 메뉴에서는 기존 로고의 기관 심볼만 보여 헤더 메뉴와 겹치지 않게 한다. */
.portalShell.aside-collapsed .shellHeaderBrand a {
    width: 60px;
    overflow: hidden;
}

.portalShell.aside-collapsed .shellHeaderBrand img {
    width: 210px;
    max-width: none;
}

.portalShell.aside-collapsed .shellAsideHeading {
    padding: 17px 0;
    justify-content: center;
}

.portalShell.aside-collapsed .shellWorkspace > .subAside {
    position: relative;
    z-index: 30;
    overflow: visible;
}

.portalShell.aside-collapsed .shellAsideTitle,
.portalShell.aside-collapsed .subAside .menuWrap {
    display: none;
}

.portalShell.aside-collapsed .asideController .shellMenuIcon {
    transform: rotate(180deg);
}

.portalShell.aside-collapsed .shellCompactNavigation {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 13px 0;
    isolation: isolate;
}

.portalShell.aside-collapsed .shellCompactNavigation::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: var(--shell-jelly-top, 13px);
    left: var(--shell-jelly-left, calc(50% - 21.5px));
    width: var(--shell-jelly-width, 43px);
    height: var(--shell-jelly-height, 42px);
    border-radius: 10px;
    background: var(--shell-primary-soft);
    opacity: 0;
    pointer-events: none;
    transform: scale(.9);
    transition: top .25s cubic-bezier(1, .2, .1, 1.2), left .25s cubic-bezier(1, .2, .1, 1.2), width .2s ease, height .2s ease, opacity .15s ease, transform .15s ease;
}

.portalShell.aside-collapsed .shellCompactNavigation.is-jelly-visible::before {
    opacity: 1;
    transform: scale(1);
}

.portalShell.aside-collapsed .shellCompactNavigation.is-jelly-moving::before {
    animation: portal-shell-jelly-over .26s ease;
}

.portalShell .shellCompactNavigation a {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 43px;
    height: 42px;
    border-radius: 8px;
    color: color-mix(in srgb, var(--ui-muted) 65%, var(--ui-white));
    background: transparent;
    transition: color .15s ease;
}

.portalShell .shellCompactNavigation a._active {
    background: var(--shell-primary);
    color: var(--ui-white);
}

.portalShell .shellCompactNavigation a:hover,
.portalShell .shellCompactNavigation a:focus-visible {
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
}

.portalShell.aside-collapsed .shellCompactNavigation.is-jelly-visible a:hover,
.portalShell.aside-collapsed .shellCompactNavigation.is-jelly-visible a:focus-visible {
    background: transparent;
    color: var(--shell-primary);
    outline: none;
}

.portalShell.aside-collapsed .shellCompactNavigation a._active,
.portalShell.aside-collapsed .shellCompactNavigation a._active:hover,
.portalShell.aside-collapsed .shellCompactNavigation a._active:focus-visible {
    background: var(--shell-primary);
    color: var(--ui-white);
}

.portalShell.aside-collapsed .shellCompactNavigation a::after {
    content: attr(aria-label);
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    z-index: 2;
    padding: 10px 13px;
    border-radius: 10px;
    color: var(--shell-primary);
    background: var(--ui-white);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--ui-ink) 14%, transparent);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(-7px, -50%);
    transition: opacity .18s ease, transform .22s ease, visibility 0s linear .22s;
}

.portalShell.aside-collapsed .shellCompactNavigation a:hover::after,
.portalShell.aside-collapsed .shellCompactNavigation a:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition-delay: 0s;
}

@keyframes portal-shell-jelly-over {
    0% {transform: scale(1, 1);}
    50% {transform: scale(.86, 1.28);}
    100% {transform: scale(1, 1);}
}

.portalShell .shellCompactNavigation .shellMenuIcon {
    width: 22px;
    height: 22px;
}

/* 푸터도 시안처럼 카드와 본문 바깥의 공통 프레임에 정렬한다. */
.portalShell .subFooter {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 0 0;
    border: 0;
    background: transparent;
}

.portalShell .subFooter .footerInner {
    align-items: flex-end;
    gap: 20px;
    color: var(--neutral-500);
    font-size: 12px;
    line-height: 1.65;
}

.portalShell .subFooter .mainFooterInfo p {
    margin: 2px 0;
    color: inherit;
    font-size: inherit;
}

.portalShell .subFooter .mainFooterBrand img {
    display: none;
}

@media (max-width: 1399px) {
    .portalShell:not(.aside-collapsed) .shellHeaderBrand img,
    .mainPage .mainLogo img {
        width: 190px;
    }
    .portalShell .subHeader .topMenuWrap {
        gap: 20px;
    }
    .portalShell .subHeader .topItemWrap {
        gap: 8px;
    }
}

/* 최소 너비 1200px: 하위 너비 분기 비활성 (복구용 보존) */
/*@media (max-width: 1199px) {
    .portalShell .subHeader .headerTop,
    .portalShell.aside-collapsed .subHeader .headerTop {
        justify-content: space-between;
        padding-bottom: 8px;
    }
    .portalShell .subHeader .menuSet {
        position: static;
        margin-left: auto;
    }
    .portalShell .subHeader .headerBottom {
        height: auto;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 0 12px;
    }
    .portalShell .subHeader .topItemWrap {
        position: static;
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-left: auto;
    }
}*/

@media (max-width: 1200px) {
    .portalShell:not(.aside-collapsed),
    .mainPage {
        --portal-sidebar-width: 300px;
        --portal-workspace-gap: 22px;
    }
}

/* 최소 너비 1200px: 하위 너비 분기 비활성 (복구용 보존) */
/*@media (max-width: 760px) {
    .portalShell,
    .mainPage {
        --portal-frame-gutter: 16px;
    }
    .portalShell .shellPageWidth {
        width: calc(100% - 32px);
        padding-top: 17px;
    }
    .portalShell .shellWorkspace,
    .portalShell:not(.aside-collapsed) .shellWorkspace,
    .portalShell.aside-collapsed .shellWorkspace {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }
    .portalShell .shellWorkspace > .subAside {
        display: none;
    }
    .portalShell .shellMobileToggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin-bottom: 14px;
        padding: 9px 12px;
        border: 1px solid var(--ui-line);
        border-radius: 7px;
        background: var(--ui-white);
        color: var(--ui-ink);
        font-size: 11px;
    }
    .portalShell.mobile-menu-open .shellWorkspace > .subAside {
        display: block;
        margin-bottom: 16px;
        border-radius: 10px;
    }
    .portalShell .subAside .shellAsideHeading,
    .portalShell.aside-collapsed .shellCompactNavigation {
        display: none;
    }
    .portalShell.aside-collapsed .subAside .menuWrap {
        display: block;
    }
    .portalShell .shellHeaderInner,
    .mainPage .mainHeaderInner {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
        padding-top: 10px;
    }
    .portalShell .shellHeaderBrand a,
    .portalShell.aside-collapsed .shellHeaderBrand a {
        width: 170px;
        overflow: visible;
    }
    .portalShell .shellHeaderBrand img,
    .portalShell.aside-collapsed .shellHeaderBrand img,
    .mainPage .mainLogo img {
        width: 170px;
    }
    .portalShell .subHeader .topMenuWrap {
        flex-wrap: wrap;
        gap: 12px;
    }
    .portalShell .subHeader .topMenuWrap a {
        padding: 8px 0;
        font-size: 15px;
    }
}*/

@media print {
    .portalShell .subAside,
    .portalShell .subFooter,
    .portalShell .shellMobileToggle {
        display: none;
    }
    .portalShell > .container {
        padding-top: 0;
    }
    .portalShell .shellPageWidth {
        display: block;
        width: 100%;
        max-width: none;
        padding: 0;
    }
    .portalShell .shellWorkspace {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portalShell .shellAsideHeading,
    .portalShell .subAside,
    .portalShell .subAside .menuWrap,
    .portalShell .subAside .underTab,
    .portalShell .shellCompactNavigation,
    .portalShell .shellCompactNavigation::before {
        transition: none;
        animation: none;
    }
}
