/* ==========================================================================
   📱 태극도 공식 모바일 앱 UX/UI 디자인 시스템 (tgd-mobile-app.css)
   - PC 화면(769px 이상)은 1px도 변경하지 않고 100% 보존합니다.
   - 모바일(768px 이하)에서만 작동하며, 상단 거대 버튼 적층을 제거하고
     모던 모바일 앱(토스·카카오·네이버 스타일)의 가로 칩 탭·컴팩트 헤더·터치 패닝·바텀 독을 적용합니다.
   ========================================================================== */

/* PC 기본 숨김 요소 (모바일 전용 세그먼트 스위처 · 하단 독 · 스와이프 힌트) */
.tgd-mo-seg-bar,
.tgd-mo-bottom-dock,
.tgd-mo-swipe-hint {
    display: none;
}

@media screen and (max-width: 768px) {

    /* ======================================================================
       0. 공통 타이포그래피 · 터치 스크롤 · 여백 기본기
       ====================================================================== */
    html, body {
        -webkit-tap-highlight-color: rgba(15, 23, 42, 0.06);
        -webkit-text-size-adjust: 100%;
    }

    body.has-tgd-mo-dock {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* 데스크톱 전용 [새 창으로] 버튼 모바일 숨김 & 상단 경로줄 초슬림화 */
    .tgd-btn-newwin,
    #btnOpenStandalone {
        display: none !important;
    }

    .tgd-ws-util-row {
        margin-bottom: 6px !important;
        padding: 0 2px !important;
        min-height: 0 !important;
    }

    .tgd-ws-bc-root {
        font-size: 11.5px !important;
    }

    .tgd-ws-bc-cur {
        font-size: 13px !important;
    }

    /* ======================================================================
       1. 공통 상단 모바일 앱 헤더 (#header) & 통합 검색 시트 (#searchOverlay)
       ====================================================================== */
    #header {
        height: 56px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: saturate(180%) blur(12px);
        -webkit-backdrop-filter: saturate(180%) blur(12px);
        border-bottom: 1px solid rgba(203, 213, 225, 0.72) !important;
        box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04);
    }

    #header .header_wrap.mo_block {
        height: 56px !important;
        padding: 0 12px !important;
    }

    #header .header_wrap.mo_block > .flex-box-center-bw {
        height: 56px !important;
    }

    #header .header_wrap.mo_block .h_logo img {
        max-width: 116px !important;
        max-height: 34px !important;
        width: auto !important;
        height: auto !important;
        display: block;
    }

    #header .header_wrap.mo_block .login_wrap .login_box {
        padding: 0 !important;
        gap: 5px !important;
    }

    #header .header_wrap.mo_block .login_wrap .login_box .log_link {
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center;
    }

    #header .header_wrap.mo_block .login_wrap .login_box .log_link a {
        padding: 0 3px !important;
        font-size: 16px !important;
    }

    .vip-organize-btn-mo {
        width: 30px !important;
        height: 30px !important;
        font-size: 18px !important;
        margin-top: 0 !important;
    }

    #header .hamburger {
        margin-left: 8px !important;
        transform: scale(0.86);
        transform-origin: right center;
    }

    /* 모바일 햄버거 드로어 메뉴 (56px 헤더 바로 아래 연결) */
    #header .header_wrap.mo_block .navigation {
        top: 56px !important;
        max-height: calc(100vh - 56px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        background: #ffffff !important;
        border-bottom: 1px solid #cbd5e1;
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
    }

    #header .header_wrap.mo_block .dep01 .parent .parent_a {
        padding: 14px 18px !important;
        font-size: 15.5px !important;
        font-weight: 800 !important;
    }

    #header .header_wrap.mo_block .dep02 .child .child_a {
        padding: 11px 22px !important;
        font-size: 14px !important;
    }

    /* 통합 검색 팝업 모달 모바일 규격화 */
    #searchOverlay {
        padding: 20px 16px !important;
        box-sizing: border-box !important;
    }

    #searchOverlay > button {
        top: 16px !important;
        right: 16px !important;
        font-size: 26px !important;
        width: 40px;
        height: 40px;
        border-radius: 999px;
        background: #f1f5f9 !important;
    }

    #searchOverlay > h2 {
        font-size: 19px !important;
        margin-bottom: 18px !important;
    }

    #searchOverlay > form {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 14px !important;
        box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08) !important;
    }

    #searchOverlay > form input[name="keyword"] {
        padding: 12px 14px !important;
        font-size: 14.5px !important;
        border-radius: 14px 0 0 14px !important;
        min-width: 0 !important;
    }

    #searchOverlay > form button[type="submit"] {
        padding: 12px 18px !important;
        font-size: 14.5px !important;
        border-radius: 0 14px 14px 0 !important;
        white-space: nowrap !important;
    }

    /* ======================================================================
       2. 서브페이지 공통 상단 (태극도 소개 · 진경 · 소식 게시판 · 자료실 · 마이페이지)
          - 기존 695px에 달하던 빈 배너·여백을 140px 이내의 앱 헤더로 압축!
       ====================================================================== */
    .sub_header {
        padding-top: 56px !important;
    }

    .sub_header .sub_header_wrap {
        height: 64px !important;
        background-position: center 42% !important;
    }

    .sub_header .s_nav_wrap.sub_lnb,
    .sub_header .sub_lnb {
        height: 40px !important;
        background-color: #2f2c29 !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .s_nav_home {
        margin-right: 4px !important;
    }

    .s_nav_home a {
        height: 40px !important;
        line-height: 40px !important;
        padding: 0 8px !important;
    }

    .s_nav_home a img {
        width: 16px !important;
        height: auto !important;
        vertical-align: middle;
    }

    .sdep01 {
        width: auto !important;
        min-width: 108px;
        max-width: 44vw;
    }

    .sdep01 > p span {
        padding: 0 26px 0 10px !important;
        font-size: 13px !important;
        line-height: 40px !important;
        max-width: 100% !important;
    }

    .sdep01 > p em {
        top: 15px !important;
        right: 9px !important;
        width: 11px !important;
    }

    .sdep01 ul {
        top: 40px !important;
        min-width: 165px !important;
        width: max-content !important;
        max-width: 78vw !important;
        border-radius: 0 0 10px 10px;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
        overflow: hidden;
        z-index: 50 !important;
    }

    .sdep01 ul li a {
        padding: 0 14px !important;
        font-size: 13.5px !important;
        line-height: 40px !important;
    }

    .sub_section {
        padding: 18px 12px 54px !important;
        box-sizing: border-box !important;
    }

    .s-inner {
        padding-left: 2px;
        padding-right: 2px;
        box-sizing: border-box;
    }

    .sTit_box {
        margin-bottom: 16px !important;
    }

    .sub_tit {
        font-size: 20px !important;
        padding: 0 8px !important;
        letter-spacing: -0.3px;
    }

    .sub_tit::after {
        height: 2.5px !important;
        bottom: -7px !important;
    }

    /* 서브페이지 상단 카테고리 탭 -> 토스·네이버 스타일 1줄 가로 터치 스와이프 칩 바 */
    .tab_box_wrap ul,
    #faith_section .tab_btnBox2 ul {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px !important;
        margin-bottom: 18px !important;
        padding: 2px 2px 6px !important;
        border: none !important;
    }

    .tab_box_wrap ul::-webkit-scrollbar,
    #faith_section .tab_btnBox2 ul::-webkit-scrollbar {
        display: none;
    }

    .tab_box_wrap ul li,
    #faith_section .tab_btnBox2 ul li {
        width: auto !important;
        flex: 0 0 auto !important;
        border: none !important;
    }

    .tab_box_wrap ul li a,
    #faith_section .tab_btnBox2 ul li a {
        padding: 8px 14px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        border-radius: 999px !important;
        border: 1px solid #d6d3d1 !important;
        background: #f8fafc !important;
        color: #44403c !important;
        white-space: nowrap !important;
        line-height: 1.2 !important;
    }

    .tab_box_wrap ul li a.on,
    .tab_box_wrap ul li.on a,
    #faith_section .tab_btnBox2 ul li.on a,
    #faith_section .tab_btnBox2 ul li a.on {
        background: #3c362f !important;
        border-color: #3c362f !important;
        color: #ffffff !important;
        box-shadow: 0 2px 6px rgba(60, 54, 47, 0.22);
    }

    /* 메인 홈 화면 상단 여백 정리 */
    #main.mo_block {
        margin-top: 56px !important;
    }

    #main_section01 article.main_sec01_wrap {
        padding-top: 24px !important;
        padding-bottom: 20px !important;
    }

    #main_section01 .main_sec01_wrap ul li.m_sec01_list {
        height: auto !important;
        min-height: 138px !important;
        padding: 16px 12px !important;
    }

    #main_section01 .main_sec01_wrap .m_sec01_list div.title p {
        font-size: 17px !important;
    }

    /* 게시판 검색바 & 글쓰기 버튼 모바일 슬림화 */
    .board_section .src_box {
        margin-bottom: 12px !important;
    }

    .board_section .src_box form input[name="keyword"] {
        height: 36px !important;
        font-size: 13.5px !important;
        padding: 0 12px !important;
        border-radius: 8px 0 0 8px !important;
    }

    .board_section .src_box form button[type="submit"] {
        height: 36px !important;
        line-height: 36px !important;
        padding: 0 14px !important;
        font-size: 13px !important;
        border-radius: 0 8px 8px 0 !important;
    }

    .board_section .src_box a[href*="Write"],
    .board_section .src_box a[href*="Edit"] {
        height: 36px !important;
        line-height: 36px !important;
        padding: 0 13px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
    }

    /* 로그인 · 회원가입 · 구 마이페이지 모바일 카드 정렬 */
    #login_section,
    #join_section {
        padding: 20px 12px 60px !important;
    }

    #login_section .login_wrap,
    #join_section .join_wrap {
        padding: 24px 16px 32px !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
    }

    #login_section .login_wrap .sTit_box,
    .join_wrap .sTit_box {
        margin-bottom: 22px !important;
    }

    #login_section .login_wrap .form_box .form_cont {
        margin-bottom: 20px !important;
    }

    #login_section .login_wrap .form_box input[type="text"],
    #login_section .login_wrap .form_box input[type="password"],
    #login_section .login_wrap .form_box input[type="email"],
    #login_section .login_wrap .form_box input[type="tel"] {
        width: 100% !important;
        height: 44px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
        box-sizing: border-box !important;
    }

    #login_section .login_wrap .form_box .cl_box {
        width: 100% !important;
    }

    #login_section .login_wrap .form_box .cl_box label,
    #login_section .login_wrap .form_box .find_box ul li a {
        font-size: 13.5px !important;
    }

    #login_section .login_wrap .form_box .submit_box {
        margin-bottom: 22px !important;
    }

    #login_section .login_wrap .form_box .submit_box button,
    #join_section .submit_box button {
        width: 100% !important;
        height: 46px !important;
        padding: 0 20px !important;
        font-size: 15.5px !important;
        border-radius: 10px !important;
    }

    /* ======================================================================
       3. 공부 관리 워크스페이스 공통 (①~⑥ · 치성 집계표)
          - 상단을 가득 채우던 4줄짜리 대형 버튼 그리드를 '1줄 가로 스와이프 앱 탭바'로 혁신!
       ====================================================================== */
    #wrap {
        padding-top: 64px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-bottom: 40px !important;
    }

    .study-nav-bar {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px !important;
        padding: 6px 8px !important;
        margin-bottom: 8px !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        border: 1px solid #dbe3ee !important;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
        align-items: center !important;
    }

    .study-nav-bar::-webkit-scrollbar {
        display: none;
    }

    .study-nav-bar > div,
    .study-nav-bar .nav-tabs-group {
        display: contents !important;
    }

    .study-nav-bar .nav-tab-item {
        width: auto !important;
        flex: 0 0 auto !important;
        min-height: 31px !important;
        height: 31px !important;
        padding: 0 11px !important;
        border-radius: 999px !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        letter-spacing: -0.2px;
        white-space: nowrap !important;
    }

    /* 서브 탭 바 (⑤ 장기자·내역·통계 / ⑥ 시학원·저장소 설정) -> 1줄 가로 스와이프 탭 */
    .sub-menu-bar {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px !important;
        padding: 6px 8px !important;
        margin-bottom: 8px !important;
        border-radius: 11px !important;
        align-items: center !important;
    }

    .sub-menu-bar::-webkit-scrollbar {
        display: none;
    }

    .sub-menu-bar > div {
        display: contents !important;
    }

    .sub-menu-bar .sub-tab-btn {
        width: auto !important;
        flex: 0 0 auto !important;
        padding: 6px 12px !important;
        height: 31px !important;
        min-height: 31px !important;
        font-size: 12px !important;
        border-radius: 999px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .sub-menu-bar .btn-red {
        flex: 0 0 auto !important;
        height: 31px !important;
        padding: 0 11px !important;
        font-size: 12px !important;
        border-radius: 999px !important;
        white-space: nowrap !important;
    }

    /* 📲 모바일 전용 섹션 빠른 전환 세그먼트 컨트롤 (토스·카카오 스타일) */
    .tgd-mo-seg-bar {
        display: flex !important;
        align-items: center;
        background: #e2e8f0;
        padding: 3px;
        border-radius: 10px;
        gap: 3px;
        margin-bottom: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tgd-mo-seg-bar::-webkit-scrollbar {
        display: none;
    }

    .tgd-mo-seg-btn {
        flex: 1 1 0;
        min-width: max-content;
        height: 31px;
        padding: 0 10px;
        border: none;
        border-radius: 8px;
        background: transparent;
        color: #475569;
        font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.15s ease;
    }

    .tgd-mo-seg-btn.active {
        background: #ffffff;
        color: #0f172a;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    }

    .tgd-mo-swipe-hint {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        font-weight: 700;
        color: #64748b;
        background: #f1f5f9;
        border: 1px solid #e2e8f0;
        border-radius: 999px;
        padding: 2px 9px;
        margin-bottom: 6px;
    }

    /* ======================================================================
       3-A. ① 신청 · 수락 · 직접등록 (StudyAdmin.cshtml) 모바일 최적화
       ====================================================================== */
    .admin-top-bar {
        padding: 10px 12px !important;
        margin-bottom: 8px !important;
        border-radius: 12px !important;
        gap: 8px !important;
    }

    .admin-title-group h2 {
        font-size: 14px !important;
        gap: 6px !important;
        flex-wrap: wrap;
    }

    .admin-title-group > div {
        display: none !important; /* 모바일에서 상단 2줄짜리 긴 안내문 숨겨 본문 영역 즉시 확보 */
    }

    .role-badge {
        font-size: 10.5px !important;
        padding: 2px 7px !important;
    }

    .mode-switch-box {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 5px !important;
        width: 100% !important;
        scrollbar-width: none;
    }

    .mode-switch-box::-webkit-scrollbar {
        display: none;
    }

    .mode-branch-select {
        height: 31px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
        border-radius: 7px !important;
        flex: 0 0 auto;
    }

    .btn-mode {
        height: 31px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
        border-radius: 7px !important;
        flex: 1 0 auto;
        white-space: nowrap !important;
    }

    /* 신청 목록 헤더 & 일괄수락 4개 버튼 컴팩트 1줄 배치 */
    .list-header {
        padding: 10px 12px !important;
        gap: 8px !important;
    }

    .list-title {
        font-size: 14.5px !important;
    }

    #selectedDateSummary {
        font-size: 11.5px !important;
    }

    .bulk-actions {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 5px !important;
        width: 100% !important;
    }

    .btn-refresh-admin,
    .btn-direct-reg,
    .btn-bulk-approve,
    .btn-bulk-reject {
        height: 32px !important;
        padding: 0 4px !important;
        font-size: 11.5px !important;
        border-radius: 7px !important;
        letter-spacing: -0.3px;
    }

    .filter-bar {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    /* 수락대기 · 전체 · 본부대기 · 최종완료 탭 -> 1줄 스와이프 칩 */
    .tab-group {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 5px !important;
        width: 100% !important;
        scrollbar-width: none;
    }

    .tab-group::-webkit-scrollbar {
        display: none;
    }

    .tab-group .tab-btn {
        flex: 0 0 auto !important;
        height: 30px !important;
        padding: 0 10px !important;
        font-size: 11.5px !important;
        border-radius: 999px !important;
        white-space: nowrap !important;
    }

    .top-hscroll-bar {
        padding: 5px 10px !important;
        font-size: 11.5px !important;
    }

    /* ======================================================================
       3-B. ② 공부반 편성 · 6종 출력 (StudyOrganize.cshtml) 모바일 최적화
       ====================================================================== */
    .board-top-info {
        padding: 10px 12px !important;
    }

    .ban-badge-title {
        font-size: 14.5px !important;
    }

    .ban-sub-info {
        font-size: 11.5px !important;
    }

    .print-btn-bar {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    .print-btn-bar > span:first-child {
        display: none !important; /* 모바일에서 긴 출력 안내 문구 숨김 */
    }

    .print-doc-grid-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 5px !important;
        padding-bottom: 2px;
    }

    .print-doc-grid-row::-webkit-scrollbar {
        display: none;
    }

    .print-doc-grid-row .btn-print-doc {
        width: auto !important;
        flex: 0 0 auto !important;
        height: 30px !important;
        min-height: 30px !important;
        padding: 0 11px !important;
        font-size: 12px !important;
        border-radius: 999px !important;
    }

    .print-bottom-action-row {
        gap: 5px !important;
        flex-wrap: wrap !important;
    }

    .print-bottom-action-row .btn-print-doc,
    .print-bottom-action-row .btn-org-refresh,
    .print-bottom-action-row .btn-org-save {
        height: 31px !important;
        padding: 0 10px !important;
        font-size: 11.5px !important;
        border-radius: 7px !important;
    }

    .trainee-filter-bar {
        padding: 6px 8px !important;
        gap: 5px !important;
    }

    .tr-flt-btn,
    .tr-flt-select,
    .tr-flt-input {
        height: 29px !important;
        font-size: 11.5px !important;
    }

    /* ======================================================================
       3-C. ③ 방 · 토론 배정판 (StudyRoom.cshtml) & ④ 입소·출석·혈압 (StudyCheck.cshtml)
       ====================================================================== */
    .room-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .room-scroll-wrap,
    .discuss-scroll-wrap,
    .check-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    .top-control-card {
        padding: 10px 12px !important;
        margin-bottom: 10px !important;
        border-radius: 12px !important;
    }

    .control-header-row {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .ban-title-text {
        font-size: 14.5px !important;
    }

    #checkDateLabel {
        font-size: 12px !important;
        margin-left: 6px !important;
    }

    .control-header-row button,
    .control-header-row input[type="date"] {
        height: 31px !important;
        padding: 0 9px !important;
        font-size: 12px !important;
    }

    /* 입소·출석·혈압 3개 통계 카드를 세로 적층 대신 한눈에 보이는 1줄 3칸 요약 카드로 구성 */
    .stat-cards-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .stat-cards-grid .stat-box {
        padding: 8px 7px !important;
        border-radius: 9px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }

    .stat-cards-grid .stat-label {
        font-size: 11px !important;
    }

    .stat-cards-grid .stat-value {
        font-size: 12px !important;
        line-height: 1.25 !important;
        word-break: keep-all;
    }

    .stat-cards-grid .stat-box button {
        height: 25px !important;
        padding: 0 7px !important;
        font-size: 10.5px !important;
        width: 100%;
    }

    /* ======================================================================
       3-D. ⑤ 장기자 · 내역 · 통계 (StudyStats.cshtml) 모바일 최적화
       ====================================================================== */
    #panelMONTHLY.content-card,
    #panelCLASS.content-card,
    #panelHISTORY.content-card,
    #panelSTAT.content-card {
        padding: 8px !important;
        border-radius: 12px !important;
    }

    .ms-header-top {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    .month-title-label {
        font-size: 13.5px !important;
        min-width: 125px !important;
    }

    .btn-month-nav,
    .btn-ms-sub {
        height: 29px !important;
        font-size: 11.5px !important;
        padding: 0 8px !important;
    }

    .ms-action-group {
        width: 100%;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 5px !important;
        scrollbar-width: none;
    }

    .ms-action-group::-webkit-scrollbar {
        display: none;
    }

    .ms-action-group .btn-gsheet {
        height: 29px !important;
        padding: 0 10px !important;
        font-size: 11.5px !important;
        border-radius: 7px !important;
        flex: 0 0 auto;
    }

    .ms-header-meta {
        padding: 8px 10px !important;
        min-height: 0 !important;
        gap: 6px !important;
    }

    .ms-kpi-group {
        font-size: 12px !important;
        gap: 6px !important;
    }

    .ms-kpi-label {
        font-size: 11.5px !important;
    }

    .ms-kpi-val {
        font-size: 13px !important;
    }

    .ms-kpi-sub {
        font-size: 11px !important;
        padding: 2px 6px !important;
    }

    /* 셀 색상 범례 7종 -> 모바일에서 3줄로 깨지지 않도록 1줄 터치 스와이프 바 처리 */
    .ms-legend-group {
        width: 100%;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px !important;
        padding-bottom: 2px;
    }

    .ms-legend-group::-webkit-scrollbar {
        display: none;
    }

    .ms-legend-title {
        font-size: 11px !important;
        flex: 0 0 auto;
    }

    .ms-swatch-item {
        width: 76px !important;
        height: 24px !important;
        grid-template-columns: 16px 1fr !important;
        padding: 0 5px 0 4px !important;
        font-size: 11px !important;
        flex: 0 0 auto;
    }

    .ms-swatch {
        width: 15px !important;
        height: 15px !important;
        font-size: 9.5px !important;
    }

    .ms-fs-size-bar {
        padding: 6px 10px !important;
    }

    .ms-search-right-box {
        width: 100%;
        margin-left: 0 !important;
    }

    .ms-search-right-box .soft-filter-input {
        flex: 1;
        width: auto !important;
        height: 31px !important;
        font-size: 12.5px !important;
    }

    .gsheet-matrix-wrap {
        max-height: 68vh !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    .gsheet-matrix-table .sticky-col-name {
        min-width: 78px !important;
        font-size: 13.5px !important;
    }

    .gsheet-matrix-table tbody tr.ms-person-row td.sticky-col-name,
    .gsheet-matrix-table tbody tr.ms-person-row td.sticky-col-name .ms-name-txt {
        font-size: 13.5px !important;
    }

    .gsheet-matrix-table .day-color-cell {
        min-width: 30px !important;
        width: 30px !important;
        font-size: 12px !important;
    }

    /* ======================================================================
       3-E. 🕯️ 치성 참석자 집계표 (ChiseongPrint.cshtml) 모바일 최적화
       ====================================================================== */
    .control-panel {
        padding: 10px 12px !important;
        border-radius: 12px !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .control-panel .ctrl-group {
        width: 100%;
        gap: 6px !important;
    }

    .control-panel .ctrl-input {
        height: 32px !important;
        padding: 0 8px !important;
        font-size: 12.5px !important;
    }

    .control-panel .btn-action {
        height: 32px !important;
        padding: 0 11px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    /* ======================================================================
       4. 📅 일반 달력 화면 (Calendar.cshtml) 모바일 앱 스타일 정교화
       ====================================================================== */
    .study-admin-shortcut-bar {
        margin-bottom: 6px !important;
        gap: 5px !important;
    }

    .study-admin-shortcut-btn {
        padding: 6px 11px !important;
        font-size: 12px !important;
        border-radius: 999px !important;
    }

    .che-shortcut-bar,
    .chi-shortcut-bar {
        padding: 8px 11px !important;
        margin-bottom: 6px !important;
        border-radius: 11px !important;
        gap: 6px !important;
    }

    .che-shortcut-bar > div:first-child,
    .chi-shortcut-bar > div:first-child {
        font-size: 12.5px !important;
    }

    .che-bar-btn,
    .chi-bar-btn {
        padding: 5px 10px !important;
        font-size: 11.5px !important;
        border-radius: 999px !important;
    }

    .calendar-app {
        border-radius: 14px !important;
    }

    .cal-header {
        padding: 11px 14px !important;
    }

    .cal-month-big {
        font-size: 21px !important;
    }

    .btn-nav {
        padding: 6px 12px !important;
        font-size: 14px !important;
    }

    /* 달력 날짜 클릭 시 뜨는 신청 창 -> 모바일 바텀 시트(Bottom Sheet) 감성 */
    #applyModal.modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #applyModal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        overflow-y: auto !important;
    }

    /* 확대 컨트롤러가 하단 퀵 독과 겹치지 않도록 위치 보정 */
    body.has-tgd-mo-dock .app-zoom-controller {
        bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ======================================================================
       5. 도인정보 관리 (/DataMan) & 성금 관리 (/Offertory) 모바일 앱 최적화
       ====================================================================== */
    .dm-main {
        padding: 8px 10px 24px !important;
        gap: 10px !important;
    }

    .dm-topbar,
    .of-topbar {
        padding: 8px 11px !important;
        border-radius: 12px !important;
        gap: 6px !important;
    }

    .dm-mobile-menu-btn,
    .of-mobile-menu-toggle {
        height: 31px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }

    .dm-bc-root,
    .of-bc-root,
    .dm-bc-sep,
    .of-bc-sep {
        display: none !important; /* 모바일 상단에서는 현재 탭 이름만 깔끔하게 강조 */
    }

    .dm-bc-current,
    .of-bc-current {
        font-size: 15px !important;
        font-weight: 900 !important;
    }

    .dm-role-badge,
    .of-role-pill {
        font-size: 11px !important;
        padding: 2px 8px !important;
    }

    .dm-topbar-actions .dm-btn,
    .of-topbar-actions .of-btn-window {
        height: 30px !important;
        padding: 0 9px !important;
        font-size: 11.5px !important;
        border-radius: 8px !important;
    }

    /* 도인정보 대시보드 4개 KPI 카드 -> 세로 1열 대신 한눈에 들어오는 2×2 그리드! */
    .dm-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .dm-kpi-card {
        padding: 11px 12px !important;
        border-radius: 12px !important;
    }

    .dm-kpi-label {
        font-size: 11.5px !important;
    }

    .dm-kpi-value {
        font-size: 18px !important;
        margin: 3px 0 !important;
    }

    .dm-kpi-sub {
        font-size: 11px !important;
    }

    .of-action-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 6px !important;
        scrollbar-width: none;
    }

    .of-action-row::-webkit-scrollbar {
        display: none;
    }

    .of-action-row button,
    .of-btn-primary,
    .of-btn-secondary {
        height: 32px !important;
        padding: 0 11px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
        flex: 0 0 auto;
    }

    .of-table-wrap,
    .dm-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    /* ======================================================================
       6. 📱 일반 홈페이지 모바일 하단 앱 네비게이션 독 (Bottom App Tab Bar)
          - 홈 · 진경 · 시법달력 · 태극도소식 · 내정보 원탭 엄지 접근!
       ====================================================================== */
    .tgd-mo-bottom-dock {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 56px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: saturate(180%) blur(14px);
        -webkit-backdrop-filter: saturate(180%) blur(14px);
        border-top: 1px solid rgba(203, 213, 225, 0.85);
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
        z-index: 9990;
        font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    }

    .tgd-mo-dock-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none !important;
        color: #64748b !important;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: -0.2px;
        transition: color 0.15s ease, transform 0.12s ease;
    }

    .tgd-mo-dock-item:active {
        transform: scale(0.94);
    }

    .tgd-mo-dock-icon {
        font-size: 18px;
        line-height: 1.1;
    }

    .tgd-mo-dock-item.is-active {
        color: #003366 !important;
        font-weight: 900;
    }

    .tgd-mo-dock-item.is-active .tgd-mo-dock-icon {
        transform: translateY(-1px);
    }

    body.monthly-fullscreen-mode .tgd-mo-bottom-dock {
        display: none !important;
    }

    @media print {
        .tgd-mo-seg-bar,
        .tgd-mo-bottom-dock,
        .tgd-mo-swipe-hint {
            display: none !important;
        }
    }
}

