/* =========================================================
   Secure Folder Web — 셸 공통 테마 (전 페이지 로드)
   흰 탑바 + 소프트 다크 사이드바 + 쿨 캔버스
   콘텐츠 영역(.contents 내부)은 건드리지 않는다
   ========================================================= */

/* 폐쇄망 대응: CDN 대신 자체 호스팅 폰트 (static/bootstrap/asset/fonts/spoqa/, OFL 1.1) */
@import url("../fonts/spoqa/spoqa.css");

/* View Transition(navigation: auto)을 세 가지 방식으로 시도했다 — 전체 페이지
   크로스페이드(밝은 콘텐츠끼리 겹쳐 번쩍임), 아주 짧은 크로스페이드(그 자체로 튐),
   사이드바 하이라이트만 부분 모핑(콘텐츠는 즉시 바뀌는데 하이라이트만 뒤늦게 따라가서
   전환 중 잠깐 엉뚱한 메뉴가 켜진 것처럼 보임 — 빠르게 연속 클릭하면 더 두드러짐).
   셋 다 원래 없던 문제를 새로 만들어서 완전히 제거. 일반 새로고침(다른 사이트와 동일)
   으로 되돌림 — 실제 버그였던 것들(active font-weight 튐, html 배경 누락, 서비스
   정보 중복 gRPC 호출)은 각각 별도로 고쳐진 채로 남아있다. */

:root {
    --sfs-primary: #2563EB;
    --sfs-primary-hover: #1D4ED8;
    --sfs-primary-light: #EFF6FF;
    --sfs-ink: #0F172A;
    --sfs-body: #3F3F46;
    --sfs-sub: #52525B;
    --sfs-faint: #71717A;
    --sfs-border: #E8EBF1;
    --sfs-canvas: #F3F5FB;
    --sfs-bg-subtle: #F1F5F9;
    --sfs-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05);
    --sfs-font: "Spoqa Han Sans Neo", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --sfs-sidebar-width: 224px;
    --sfs-sidebar-collapsed-width: 68px;
    --sfs-sidebar-gap: 24px;
}

body,
button,
input,
select,
textarea {
    font-family: var(--sfs-font);
    -webkit-font-smoothing: antialiased;
}

/* ===== 탑바 ===== */
.header,
.dashboard .header,
.normal .header {
    background: #FFFFFF !important;
    border-bottom: 1px solid var(--sfs-border);
    box-shadow: none;
}

.header .logo img {
    content: url("../images/securefolder_logo_basic.svg");
    height: 21px !important;
    width: auto !important;
}

.header .menu .menu-tit {
    height: 38px;
    font-size: 15px;
    font-weight: 500;
    color: var(--sfs-sub) !important;
    border-radius: 999px;
    transform: none;
    transition: color .15s ease-out, background-color .15s ease-out;
}

.header .menu .menu-tit:hover {
    color: var(--sfs-ink) !important;
    background: var(--sfs-bg-subtle);
    transform: none;
}

.header .menu .menu-tit.active,
.header .menu .menu-tit:active {
    color: var(--sfs-primary-hover) !important;
    background: var(--sfs-primary-light);
    font-weight: 600;
    transform: none;
}

.session-timer {
    gap: 7px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--sfs-bg-subtle);
    color: var(--sfs-sub);
    font-size: 14px;
    font-weight: 500;
}

.session-timer img {
    width: 15px;
    height: 15px;
    filter: none;
    opacity: 0.55;
}

/* 타이머 숫자는 놓인 곳(.lnb-session-timer 등)의 색을 따른다.
   옛 톱바 시절 ID 규칙이 진회색을 강제해 다크 사이드바에서 까맣게 보이던 문제 */
#header-timer {
    color: inherit;
    font-weight: inherit;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.header .menu-box .user-memu a .user-icon,
.header .menu-box .user-memu a.active .user-icon {
    background-image: url("../images/icon-user-g.svg");
}

.header .menu-box .user-memu a:hover .user-icon {
    background-image: url("../images/icon-user-active.svg");
}

.user-profile {
    color: var(--sfs-body);
}

/* ===== 사이드바 ===== */
.lnb {
    background: #243044;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
    overflow-x: hidden;
}

/* 접기/펼치기 스르륵 — 사용자가 토글 버튼을 누른 순간(body.lnb-animating)에만 적용.
   페이지 새로고침/이동 시 localStorage 상태를 즉시 복원할 때는 transition이 없어야
   매번 사이드바가 움찔거리며 다시 접히는 게 안 보인다. */
body.lnb-animating .lnb {
    transition: width .28s cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .lnb {
        transition: none;
    }
}

/* 폭 전환 중 텍스트가 줄바꿈되며 덜컹거리지 않게 */
.lnb-nav a,
.lnb-group-label {
    white-space: nowrap;
}

.lnb .lnb-head {
    display: none;
}

.lnb ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.lnb a {
    text-decoration: none;
}

.lnb h2 {
    margin-top: 0;
    color: var(--sfs-faint);
    font-size: 12.5px;
    font-weight: 600;
}

.lnb-brand {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 12px 10px;
}

.lnb-brand a {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    font-size: 15px;
    font-weight: 700;
    color: #F8FAFC;
    text-decoration: none;
}

.lnb-brand img {
    flex: none;
    width: 24px;
    height: 24px;
    display: block;
}

.lnb-brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lnb-collapse-btn {
    flex: none;
    position: absolute;
    top: 19px;
    right: -13px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: #2E3B51;
    color: #B8C4D4;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.lnb-collapse-btn:hover {
    background: #37465E;
    color: #FFFFFF;
}

.lnb-collapse-btn svg {
    width: 17px;
    height: 17px;
}

/* 콘솔(사이드바가 있는) 화면은 톱바를 완전히 접고, 브랜드는 사이드바 상단으로 이동.
   로그인/가입 등 isRoot 페이지는 사이드바가 없어 톱바를 그대로 유지. */
body.dashboard.sub .header {
    display: none;
}

body.dashboard.sub .lnb {
    top: 0;
    width: var(--sfs-sidebar-width);
    height: 100vh;
    /* .section이 불투명 캔버스 배경(아래 body.sub .section 규칙)을 깔고 있어서,
       DOM 순서상 뒤에 오는 .section이 고정 사이드바를 덮어버림 — 항상 위에 그려지도록 고정 */
    z-index: 5;
}

body.dashboard.sub .section {
    padding-top: 24px;
    padding-left: calc(var(--sfs-sidebar-width) + var(--sfs-sidebar-gap));
}

/* 사이드바 접힘에 맞춰 콘텐츠도 같이 스르륵 — 위 .lnb와 동일하게 실제 토글 시에만 */
body.lnb-animating.dashboard.sub .section {
    transition: padding-left .28s cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
    body.dashboard.sub .section {
        transition: none;
    }
}

/* 사이드바-콘텐츠 간격 최종 정리.
   style.css에 legacy body.sub .section{margin-left:240px}와 .contents{padding:50px 80px 80px}가
   중복 정의돼 있어(라인 6520/6527 근처, 구버전 다크 셸 잔재) 우리 padding-left:264px 위에
   240px 마진 + 80px 패딩이 추가로 쌓이고 있었음. 전부 무력화하고 section의 padding-left만 남김. */
body.dashboard.sub .section {
    margin-left: 0;
}

body.dashboard.sub .contents {
    padding-left: 0;
}

body.dashboard.sub .contents .inner {
    margin-left: 0;
}

/* ===== 반응형(노트북·창 분할 구간) =====
   legacy .contents{min-width:1210px}가 사이드바 280px과 합쳐져 뷰포트 1490px부터
   가로 스크롤을 만들던 문제 — 콘솔 화면은 최소폭을 풀고 콘텐츠가 접히게 한다.
   표처럼 진짜 넓어야 하는 요소는 콘텐츠 영역 안에서 자체 가로 스크롤. */
body.dashboard.sub .contents {
    min-width: 0;
    overflow-x: auto;
}

@media (max-width: 1200px) {
    body.dashboard.sub .section {
        padding-left: calc(var(--sfs-sidebar-width) + var(--sfs-sidebar-gap));
    }
}

body.dashboard.sub.lnb-collapsed .lnb {
    width: var(--sfs-sidebar-collapsed-width);
}

body.dashboard.sub.lnb-collapsed .section {
    padding-left: calc(var(--sfs-sidebar-collapsed-width) + var(--sfs-sidebar-gap));
}

body.dashboard.sub.lnb-collapsed .lnb-brand {
    justify-content: center;
    padding-left: 6px;
    padding-right: 6px;
}

body.dashboard.sub.lnb-collapsed .lnb-brand a {
    flex: none;
}

body.dashboard.sub.lnb-collapsed .lnb-brand-text,
body.dashboard.sub.lnb-collapsed .lnb-nav > ul > li > a,
body.dashboard.sub.lnb-collapsed .lnb-group-label {
    font-size: 0;
}

/* 세션 잔여 시간은 접어도 계속 보여야 하는 보안 정보 —
   68px 레일에선 아이콘을 빼고 숫자만 가운데로 */
body.dashboard.sub.lnb-collapsed .lnb-session-timer {
    justify-content: center;
    gap: 0;
    padding: 3px 0 9px;
    font-size: 11px;
}

body.dashboard.sub.lnb-collapsed .lnb-session-timer img,
body.dashboard.sub.lnb-collapsed .lnb-timer-label,
body.dashboard.sub.lnb-collapsed .lnb-extend {
    display: none;
}

body.dashboard.sub.lnb-collapsed .lnb-account-info {
    display: none;
}

body.dashboard.sub.lnb-collapsed .lnb-nav > ul > li > a {
    justify-content: center;
    gap: 0;
    padding: 0;
}

body.dashboard.sub.lnb-collapsed .lnb-group-label {
    justify-content: center;
    gap: 0;
    padding: 0;
}

/* 접힘 상태: 섹션 아이콘에 올리면 하위 메뉴가 오른쪽으로 플라이아웃.
   (Azure/AWS 콘솔·VS Code 표준. 안 그러면 접었을 때 하위 메뉴에 아예 접근 불가) */
body.dashboard.sub.lnb-collapsed .lnb {
    overflow: visible; /* 플라이아웃이 사이드바 밖으로 나가야 하므로 클리핑 해제 */
}

body.dashboard.sub.lnb-collapsed .lnb-group {
    position: relative;
}

body.dashboard.sub.lnb-collapsed .lnb-group-label {
    cursor: pointer;
}

body.dashboard.sub.lnb-collapsed .lnb-group ul {
    display: block;
    position: absolute;
    left: 100%;
    top: -6px;
    z-index: 30;
    min-width: 172px;
    margin-left: 6px;
    padding: 6px;
    background: #FFFFFF;
    border: 1px solid #D5DCE8;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity .15s ease-out, transform .15s ease-out, visibility .15s;
}

body.dashboard.sub.lnb-collapsed .lnb-group:hover > ul,
body.dashboard.sub.lnb-collapsed .lnb-group:focus-within > ul {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

body.dashboard.sub.lnb-collapsed .lnb-group ul a {
    padding: 0 10px;
    color: var(--sfs-body);
}

body.dashboard.sub.lnb-collapsed .lnb-group ul a:hover {
    color: var(--sfs-ink);
    background: #F1F5F9;
}

body.dashboard.sub.lnb-collapsed .lnb-group ul a.active {
    color: #1E4E9A;
    background: #E9EFF8;
}

@media (prefers-reduced-motion: reduce) {
    body.dashboard.sub.lnb-collapsed .lnb-group ul {
        transition: none;
    }
}

/* 접기/펼치기 전환 중에는 플라이아웃 전환을 끈다.
   안 그러면 접히는 순간 인라인 하위 메뉴가 플라이아웃 모양(absolute)으로 바뀐 채
   0.15초 동안 서서히 사라져서, 메뉴창이 잠깐 떴다 닫히는 것처럼 보임 */
body.lnb-animating .lnb-group ul {
    transition: none !important;
}

body.dashboard.sub.lnb-collapsed .lnb-collapse-btn svg {
    transform: rotate(180deg);
}

body.dashboard.sub.lnb-collapsed .lnb-collapse-btn {
    right: -13px;
}

/* 접힘 상태 계정 블록: 68px 레일에선 이름·아바타를 빼고 로그아웃만 남긴다.
   (로그아웃은 접어도 반드시 닿을 수 있어야 하는 주요 동작) */
body.dashboard.sub.lnb-collapsed .lnb-account {
    justify-content: center;
    gap: 0;
    padding: 6px 0;
    background: none;
    box-shadow: none;
}

body.dashboard.sub.lnb-collapsed .lnb-account-avatar {
    display: none;
}

/* 접힘 상태 로그아웃: 라이트 카드가 사라지고 다크 푸터 위에 놓이므로 밝은 톤으로 */
body.dashboard.sub.lnb-collapsed .lnb-logout {
    color: #B8C4D4;
}

body.dashboard.sub.lnb-collapsed .lnb-logout:hover {
    color: #FCA5A5;
    background: rgba(220, 38, 38, 0.18);
}

/* 흰 플라이아웃 패널 안의 비활성 항목: 다크용 회색이 아닌 라이트용 회색 */
body.dashboard.sub.lnb-collapsed .lnb-group ul a.disabled {
    color: #9AA6B5;
}

/* 하단 고정: 세션 타이머 + 계정 */
.lnb-footer {
    margin-top: auto;
    flex: none;
    padding: 10px 10px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    background: #202B3C;
}

.lnb-session-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 10px;
    /* 보안 정보(잔여 시간)라 다크 배경에서도 또렷해야 함 */
    color: #D8E1EC;
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 역할 라벨: 숫자가 뭘 의미하는지 명시 */
.lnb-timer-label {
    color: #93A1B5;
    font-weight: 500;
}

/* 세션 연장: 경고 팝업까지 안 가고 바로 연장 */
.lnb-extend {
    margin-left: auto;
    padding: 3px 9px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 7px;
    background: none;
    color: #B8C4D4;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s ease-out, background-color .15s ease-out, border-color .15s ease-out;
}

.lnb-extend:hover {
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.07);
}

.lnb-session-timer img {
    width: 13px;
    height: 13px;
    opacity: 0.85;
    filter: brightness(0) invert(1);
}

.lnb-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 7px;
    border-radius: 10px;
    background: #F8FAFC;
    box-shadow: inset 0 0 0 1px #D6DEE9;
}

.lnb-account:hover {
    background: #FFFFFF;
}

.lnb-account-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #2563EB;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
}

.lnb-account-info {
    min-width: 0;
    flex: 1 1 auto;
}

.lnb-account-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lnb-account-role {
    margin-top: 2px;
    font-size: 11.5px;
    color: #64748B;
}

.lnb-logout {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 0;
    background: none;
    color: #64748B;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: color .15s ease-out, background-color .15s ease-out;
}

.lnb-logout svg {
    width: 16px;
    height: 16px;
}

.lnb-logout:hover {
    color: #B91C1C;
    background: #FEF2F2;
}

.lnb-nav > ul {
    margin-top: 4px;
    padding: 0 10px;
}

.lnb-nav > ul > li {
    border-bottom: 0;
}

.lnb-nav > ul > li a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    margin: 2px 0;
    padding: 0 11px;
    border-radius: 8px;
    color: #E6EDF5;
    font-size: 14px;
    font-weight: 500;
    transition: color .15s ease-out, background-color .15s ease-out;
}

.lnb-nav > ul > li > a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.07);
}

.lnb-nav > ul > li > a.active {
    color: #FFFFFF;
    background: #4A5C74;
    /* font-weight는 절대 안 바꾼다 — 페이지 전환 시 크롬이 이전/다음 화면을 겹쳐
       보여주는 순간(paint holding), 글자 굵기가 다르면 두 모양이 안 맞아떨어져서
       "글씨가 굵어졌다 얇아지는" 것처럼 튀어 보인다. 배경/색상만으로 활성 표시. */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.lnb-nav > ul > li > a.active::before {
    display: none;
}

/* 구식 화살표/막대 제거 */
.lnb-nav > ul > li > a:after {
    display: none;
}

/* 메뉴 스트로크 아이콘 */
.lnb .mi {
    flex: none;
    width: 17px;
    height: 17px;
    color: #AEBCCD;
    display: inline-grid;
    place-items: center;
}

.lnb .mi svg {
    width: 100%;
    height: 100%;
}

.lnb-nav > ul > li > a:hover .mi {
    color: #D4DEE9;
}

.lnb-nav > ul > li > a.active .mi {
    color: #FFFFFF;
}

.lnb-nav > ul > li > a.disabled {
    color: #8B99AC;
    cursor: not-allowed;
}

.lnb-nav > ul > li > a.disabled .mi {
    color: #8B99AC;
    opacity: 0.6;
}

/* 톱바 내비 흡수: 하위 항목 없는 단독 링크 묶음(홈/감사로그)은 기존 .lnb > ul 규칙을 그대로 재사용 */

/* 하위 항목이 있는 섹션 그룹 (서비스/고객 지원/설정) */
.lnb-group {
    margin-top: 10px;
    padding: 0 10px;
}

.lnb-group-label {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 11px;
    margin-bottom: 1px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0;
    color: #CFD9E5;
    text-transform: none;
    line-height: 1;
}

.lnb-section-icon {
    flex: none;
    width: 17px;
    height: 17px;
    color: #BFCBDA;
    display: inline-grid;
    place-items: center;
}

.lnb-section-icon svg {
    width: 100%;
    height: 100%;
}

.lnb-group ul {
    display: block;
}

.lnb-group li {
    border-bottom: 0;
}

.lnb-group li a {
    position: relative;
    display: block;
    height: 30px;
    line-height: 30px;
    margin: 1px 0;
    padding: 0 11px 0 38px;
    border-radius: 8px;
    color: #E0E7F0;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s ease-out, background-color .15s ease-out;
}

.lnb-group li a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.07);
}

.lnb-group li a.active {
    color: #FFFFFF;
    background: #4A5C74;
    /* font-weight 고정 이유는 위 .lnb-nav > ul > li > a.active 주석 참고 */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.lnb-group li a.active::before {
    display: none;
}

.lnb-group li a.disabled {
    color: #8B99AC;
    cursor: not-allowed;
}

.lnb a:focus-visible,
.lnb button:focus-visible {
    outline: 2px solid rgba(147, 197, 253, 0.62);
    outline-offset: 2px;
}

/* ===== 캔버스 ===== */
/* html 자체도 배경을 깔아둔다 — View Transition 크로스페이드 중 body 뒤로
   비치는 배경이 흰색이면 화면 전체가 잠깐 번쩍이는 것처럼 보인다 */
html {
    background: var(--sfs-canvas);
}

body {
    background: var(--sfs-canvas) !important;
}

body.sub .section {
    background: var(--sfs-canvas);
}

/* 상단 GNB: 로고를 플로우에 넣고 그 옆에서 시작 (absolute 로고 겹침 해결) */
.header > .header {
    position: static !important;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    border-bottom: 0;
    box-shadow: none;
}

.header .logo {
    position: static !important;
    left: auto;
    bottom: auto;
    width: auto !important;
    margin-left: 28px;
    display: flex;
    align-items: center;
    flex: none;
}

.header .nav {
    margin-left: 36px;
    height: 100%;
}

.header .gnb {
    gap: 6px;
}

.header .menu {
    width: auto;
    min-width: 0;
    margin-right: 0;
}

/* 프로필 드롭다운: 구시대 대형 그림자 → 표준 팝오버, 파랑 필 제거 */
.header .menu-box .user-memu .user-info {
    border: 1px solid var(--sfs-border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
    overflow: hidden;
}

.user-info .btn-b {
    background: #fff;
    border: 1px solid #CBD5E1;
    color: var(--sfs-body);
}

.user-info .btn-b:hover {
    background: #fff;
    border-color: var(--sfs-ink);
    color: var(--sfs-ink);
}

.user-info .info-box img {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

.user-info .user-name .fs15 {
    font-size: 14px !important;
    font-weight: 600;
    color: var(--sfs-ink);
}

.user-info .user-mail {
    color: var(--sfs-sub);
}

/* 캔버스: 흰 콘텐츠 패널이 또렷이 떠 보이도록 한 단계 깊은 쿨그레이.
   (다크 사이드바 채택 후 #F8F9FB는 흰 패널과 경계가 안 보였음) */
:root {
    --sfs-canvas: #ECF0F6;
    --sfs-border: #E2E4E9;
}
