/* 넙치 질병진단 시스템 — Bootswatch Flatly 테마 보조 스타일 */
/* Flatly가 색상/컴포넌트를 처리하므로 여기서는 터치 최적화 + 레이아웃만 담당 */

/* ===== 모바일 터치 딜레이 제거 + 터치 피드백 ===== */
a, button, .btn, .card, [role="button"] {
    touch-action: manipulation;
}

a > .card:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

/* ===== 0. CSS 변수 (브랜드 테마) ===== */
:root {
    /* 브랜드 색상 */
    --primary: #2c3e50;
    --primary-rgb: 44, 62, 80;
    --primary-light: #3d566e;
    --accent: #18bc9c;          /* Flatly success (청록) */
    --accent-rgb: 24, 188, 156;

    /* 표면/배경 */
    --background: #f5f7fa;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.65);

    /* 텍스트 */
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --border: #dee2e6;

    /* 카드 */
    --card-radius: 12px;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ===== 1. 기본 타이포그래피 ===== */
body {
    font-family: 'Pretendard Variable', Pretendard, -apple-system,
                 BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue',
                 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR',
                 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji',
                 'Segoe UI Symbol', sans-serif;
    font-size: 1rem;
    background-color: var(--background);
}

/* 네비바 로고 */
.navbar {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}
.navbar-emblem {
    height: 48px;
    width: 48px;
    margin-right: 10px;
    border-radius: 50%;
}
.navbar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}
.navbar-brand-text small {
    font-weight: 400;
    font-size: 0.7em;
    opacity: 0.85;
    margin-left: 2px;
}
.navbar-toggler,
.navbar-toggler:focus,
.navbar-toggler:active {
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: none;
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='white' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* 네비바 링크 가독성 보정 (Flatly 기본 65% → 90%) */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.90);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    padding-left: 1.2rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

/* 탭 피드백 — 누르는 순간 밝아짐 */
.navbar-dark .navbar-nav .nav-link:active {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
}

/* 현재 페이지 강조 — 천천히 깜빡 */
@keyframes nav-pulse {
    0%, 100% { background: rgba(255, 255, 255, 0.18); }
    50%       { background: rgba(255, 255, 255, 0.05); }
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
    font-weight: 600;
    animation: nav-pulse 3s ease-in-out infinite;
}

/* ===== 2. 터치 최적화 (최소 44px 터치 타겟) ===== */
.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-control, .form-select {
    min-height: 44px;
}

/* ===== 3. 카드 스타일 (통일) ===== */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    border-radius: var(--card-radius);
}

.card-header {
    font-weight: 600;
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

/* 클릭 가능한 카드만 인터랙션 효과 */
a > .card,
.card[onclick] {
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

a > .card:hover,
.card[onclick]:hover {
    box-shadow: var(--card-shadow-hover);
}

a > .card:active,
.card[onclick]:active {
    transform: scale(0.97);
}

/* 보더 있는 카드 유지 */
.card[class*="border-"] {
    border-style: solid;
    border-width: 1px;
}

/* ===== 4. 페이지 헤더 (통일) ===== */
.page-header {
    padding-bottom: 0.5rem;
}

.page-header h4 {
    font-weight: 700;
}

/* ===== 5. 증상 체크박스 터치 영역 ===== */
.symptom-check {
    min-height: 44px;
    border-radius: 6px;
    cursor: pointer;
}

.symptom-check:active {
    background-color: rgba(var(--accent-rgb), 0.1);
}

.symptom-check .form-check-input {
    width: 24px;
    height: 24px;
}

/* 추가 증상 스크롤 리스트 */
.symptom-scroll-list {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== 6. 하단 고정 바 ===== */
.diagnosis-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: none;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 1030;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

/* ===== 7. 단계별 진행 표시기 ===== */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
}

/* 6단계: 좁은 화면에서 축소 */
.step-indicator-6 .step-item {
    min-width: 40px;
}

.step-indicator-6 .step-line {
    max-width: 28px;
}

/* 7단계: 더 좁은 화면 대응 */
.step-indicator-7 .step-item {
    min-width: 34px;
}

.step-indicator-7 .step-line {
    max-width: 20px;
}

.step-indicator-7 .step-number {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
}

.step-indicator-7 .step-label {
    font-size: 0.6rem;
}

/* 8단계: 최소 너비 + 작은 글씨 */
.step-indicator-8 .step-item {
    min-width: 28px;
}

.step-indicator-8 .step-line {
    max-width: 12px;
}

.step-indicator-8 .step-number {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
}

.step-indicator-8 .step-label {
    font-size: 0.55rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dee2e6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: background var(--transition-fast);
}

.step-indicator-6 .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.step-indicator-6 .step-label {
    font-size: 0.65rem;
}

/* VHS 검사 라디오 옵션 */
.vhs-radio-option {
    min-height: 44px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.vhs-radio-option:active {
    background-color: rgba(var(--accent-rgb), 0.1);
}

.vhs-radio-option .form-check-input {
    width: 22px;
    height: 22px;
}

.step-item.active .step-number {
    background: var(--accent);
}

.step-label {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 4px;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.step-item.active .step-label {
    color: var(--accent);
}

.step-line {
    flex: 1;
    height: 2px;
    background: #dee2e6;
    margin: 0 2px;
    margin-bottom: 20px;
    max-width: 40px;
}

/* ===== 8. 대시보드: 미니 통계 카드 ===== */
.stat-mini-card {
    cursor: default;
}

/* ===== 9. 대시보드: 바로가기 카드 ===== */
.shortcut-card {
    border-left: none;
}

.border-start-accent {
    border-left: 4px solid transparent !important;
}

.border-start-accent-primary { border-left-color: var(--bs-primary) !important; }
.border-start-accent-success { border-left-color: var(--bs-success) !important; }
.border-start-accent-info { border-left-color: var(--bs-info) !important; }
.border-start-accent-warning { border-left-color: var(--bs-warning) !important; }

.shortcut-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* 최근 진단 항목 */
.recent-diagnosis-item {
    transition: background var(--transition-fast);
}

.recent-diagnosis-item:hover {
    background: rgba(var(--accent-rgb), 0.05);
}

/* ===== 10. 진단 결과: 1위 히어로 카드 ===== */
.top-result-hero {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.08) 0%, rgba(var(--accent-rgb), 0.02) 100%);
    border: 2px solid rgba(var(--accent-rgb), 0.3) !important;
}

.top-result-score {
    text-align: center;
    line-height: 1;
}

.top-result-score .score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.top-result-score .score-label {
    font-size: 0.75rem;
    color: #adb5bd;
    display: block;
}

/* ===== 11. 진단 요약 아이콘 ===== */
.summary-icon-item {
    padding: 8px 4px;
}

.summary-icon-item i {
    font-size: 1.3rem;
}

/* ===== 12. 룰 메시지 스타일 ===== */
.rule-message {
    border-left: 4px solid transparent;
    border-radius: 4px;
}

.rule-message-danger {
    border-left-color: var(--bs-danger);
}

.rule-message-warning {
    border-left-color: var(--bs-warning);
}

.rule-message-info {
    border-left-color: var(--bs-info);
}

/* ===== 13. 빈 상태 일러스트 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #adb5bd;
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* ===== 14. 로그인 페이지 ===== */

/* ===== 15. 사진 갤러리 ===== */
.photo-thumb-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.photo-thumb:active {
    opacity: 0.8;
}

.photo-delete-form {
    position: absolute;
    top: 4px;
    right: 4px;
}

.photo-delete-btn {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    opacity: 0.8;
    /* 터치 타겟 44px 확보 (시각적 크기는 28px 유지) */
    position: relative;
}
.photo-delete-btn::before,
.group-delete-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}
.group-delete-btn {
    position: relative;
}

.photo-modal-img {
    max-width: 100%;
    max-height: 70vh;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.modal-body:has(.photo-modal-img) {
    position: relative;
}

.photo-zoom-hint {
    display: block;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.45);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.72rem;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    white-space: nowrap;
}

/* ===== 16. 통계 카드 ===== */
.stats-card {
    cursor: default;
}

/* ===== 17. 관리 페이지 테이블 ===== */
.table-responsive .table th {
    font-size: 0.9rem;
    white-space: nowrap;
}

.table-responsive .table td {
    font-size: 1rem;
}


/* ===== 18. 네비바 브랜드 ===== */
.navbar-brand {
    font-weight: 600;
}

/* ===== 19. Flash 메시지 애니메이션 ===== */
.alert {
    transition: opacity 0.3s ease-out;
}

.alert.fade-out {
    opacity: 0;
}

/* ===== 20. 뱃지 소형 ===== */
.badge-sm {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

/* ===== 21. 증상 검색바 ===== */
.symptom-search-bar {
    background: #f5f7fa;
    padding: 8px 0;
}

/* ===== 22. 신뢰도 박스 ===== */
.confidence-box {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.confidence-high {
    background: rgba(24, 188, 156, 0.1);
    color: #18bc9c;
    border: 1px solid rgba(24, 188, 156, 0.3);
}

.confidence-medium {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.confidence-low {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* ===== 23. 복합 감염 경고 ===== */
.compound-infection-alert {
    padding: 14px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(243, 156, 18, 0.1) 100%);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.compound-suspect-card {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.06) 0%, rgba(243, 156, 18, 0.04) 100%);
    border: 2px solid rgba(231, 76, 60, 0.25) !important;
}

.compound-suspect-card .score-value {
    color: #e74c3c;
}

/* ===== 25. 사진 미리보기 (폼 내) ===== */
.photo-preview-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    flex-shrink: 0;
    position: relative;
}

.photo-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.photo-preview-thumb .photo-size-label {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0 0 8px 8px;
    padding: 1px 0;
}

.photo-preview-thumb .btn-remove-photo {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
}

/* ===== 26. 하단 바 뱃지 행 ===== */
.selected-badges-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.selected-badges-row::-webkit-scrollbar {
    display: none;
}

/* ===== 27. 양식장 카드 ===== */
.farm-card {
    border-left: 4px solid var(--bs-primary) !important;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.farm-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.farm-card:active {
    transform: scale(0.97);
}

/* ===== 28. 의약품 카드 ===== */
.medicine-card {
    border-left: 4px solid var(--bs-info) !important;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.medicine-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.medicine-card:active {
    transform: scale(0.97);
}

/* 의약품 원본 텍스트 (줄바꿈 보존) */
.medicine-raw-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 의약품 HTML 콘텐츠 (NFQS 원본 테이블) */
.medicine-html-content {
    font-size: 0.85rem;
    overflow-x: auto;
}
.medicine-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.5rem;
}
.medicine-html-content table td,
.medicine-html-content table th {
    border: 1px solid #dee2e6;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    vertical-align: middle;
}
.medicine-html-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* 의약품 용법 테이블 (텍스트아트 → HTML 변환) */
.dosage-table {
    table-layout: auto;
    width: auto !important;
    font-size: 0.82rem;
}
.dosage-table th,
.dosage-table td {
    white-space: nowrap;
    text-align: center;
    padding: 0.3rem 0.5rem !important;
}
.dosage-table td:first-child,
.dosage-table td:nth-child(2) {
    text-align: left;
}

/* 아웃라인 배지 */
.badge.bg-outline-secondary {
    background: transparent !important;
    color: var(--bs-secondary);
    border: 1px solid var(--bs-secondary);
}

/* ===== 29. Glassmorphism 카드 ===== */
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* ===== 30. 스크롤 진입 애니메이션 ===== */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 순차 등장: 각 카드에 약간의 딜레이 */
.fade-up-delay-1 { transition-delay: 0.08s; }
.fade-up-delay-2 { transition-delay: 0.16s; }
.fade-up-delay-3 { transition-delay: 0.24s; }
.fade-up-delay-4 { transition-delay: 0.32s; }

/* 접근성: 모션 감소 선호 시 애니메이션 비활성화 */
@media (prefers-reduced-motion: reduce) {
    .fade-up {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* =============================================================
   통합 캘린더 (v2.38.0)
   ============================================================= */

/* FullCalendar 모바일 최적화 */
#calendar .fc-toolbar {
    flex-wrap: wrap;
    gap: 0.25rem;
}

#calendar .fc-toolbar-chunk {
    display: flex;
    gap: 0.25rem;
}

#calendar .fc-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* 리스트 뷰: 행 최소 터치 타겟 44px */
#calendar .fc-list-event td {
    min-height: 44px;
    vertical-align: middle;
}

/* 리스트 뷰: 시간 컬럼('올데이') 숨김 — 모든 이벤트가 종일 이벤트이므로 불필요 */
#calendar .fc-list-event-time {
    display: none;
}

/* 월 뷰 이벤트 글자색 — FullCalendar 인라인 white 덮어쓰기 */
#calendar .fc-daygrid-event .fc-event-main,
#calendar .fc-daygrid-event .fc-event-title {
    color: #333 !important;
}

/* 캘린더 빠른 등록 메뉴 — 보라/청록 버튼 */
.text-purple { color: #6f42c1 !important; }
.border-purple { border-color: #6f42c1 !important; }
.btn-outline-purple:hover { background-color: #6f42c1; color: #fff !important; border-color: #6f42c1 !important; }
.text-teal { color: #20c997 !important; }
.border-teal { border-color: #20c997 !important; }
.btn-outline-teal:hover { background-color: #20c997; color: #fff !important; border-color: #20c997 !important; }

/* 필터 패널 chevron 회전 */
#filterChevron {
    transition: transform 0.2s ease;
    font-size: 0.7em;
}

/* 필터 체크박스 레이블 */
.form-check-sm .form-check-input {
    width: 1em;
    height: 1em;
}

/* 이벤트 타입 배지 */
#filter-types .badge {
    font-size: 0.75rem;
    cursor: pointer;
}

@media (max-width: 576px) {
    #calendar .fc-toolbar-title {
        font-size: 1rem;
    }
    #calendar .fc-button-group .fc-button {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}


/* ===== 폼 페이지 너비 래퍼 (이중 컨테이너 방지) ===== */
.form-page-wrap {
    max-width: 720px;
    margin: 0 auto;
}

/* ===== 31. Offcanvas 네비게이션 (모바일) ===== */

/* 그룹별 색상 변수 */
:root {
    --nav-core: 243, 156, 18;       /* #f39c12 주황 — 핵심 업무 */
    --nav-history: 52, 152, 219;    /* #3498db 파랑 — 이력 관리 */
    --nav-ref: 24, 188, 156;        /* #18bc9c 청록 — 참조/분석 */
    --nav-admin: 149, 165, 166;     /* #95a5a6 회색 — 관리 */
}

#navOffcanvas {
    max-width: 280px;
}

#navOffcanvas .offcanvas-header {
    padding: 0.75rem 1rem;
}

#navOffcanvas .offcanvas-body {
    display: flex;
    flex-direction: column;
}

/* 그룹 간 간격 + 좌측 컬러 보더 */
#navAccordion .accordion-item {
    border-left: 3px solid transparent;
    margin-bottom: 6px;
}

#navAccordion .accordion-item:last-child {
    margin-bottom: 0;
}

/* 그룹별 좌측 보더 색상 */
#navAccordion .accordion-item:nth-child(1) { border-left-color: rgb(var(--nav-core)); }
#navAccordion .accordion-item:nth-child(2) { border-left-color: rgb(var(--nav-history)); }
#navAccordion .accordion-item:nth-child(3) { border-left-color: rgb(var(--nav-ref)); }
#navAccordion .accordion-item:nth-child(4) { border-left-color: rgb(var(--nav-admin)); }

/* Accordion 버튼 스타일 */
.nav-accordion-btn {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    background: transparent;
}

.nav-accordion-btn::after {
    width: 0.9rem;
    height: 0.9rem;
    background-size: 0.9rem;
}

/* 그룹 헤더 아이콘 색상 */
#navAccordion .accordion-item:nth-child(1) .nav-accordion-btn i { color: rgb(var(--nav-core)); }
#navAccordion .accordion-item:nth-child(2) .nav-accordion-btn i { color: rgb(var(--nav-history)); }
#navAccordion .accordion-item:nth-child(3) .nav-accordion-btn i { color: rgb(var(--nav-ref)); }
#navAccordion .accordion-item:nth-child(4) .nav-accordion-btn i { color: rgb(var(--nav-admin)); }

/* 열린 상태: 그룹별 배경 */
#navAccordion .accordion-item:nth-child(1) .nav-accordion-btn:not(.collapsed) {
    color: var(--text-primary);
    background: rgba(var(--nav-core), 0.07);
    box-shadow: none;
}
#navAccordion .accordion-item:nth-child(2) .nav-accordion-btn:not(.collapsed) {
    color: var(--text-primary);
    background: rgba(var(--nav-history), 0.07);
    box-shadow: none;
}
#navAccordion .accordion-item:nth-child(3) .nav-accordion-btn:not(.collapsed) {
    color: var(--text-primary);
    background: rgba(var(--nav-ref), 0.07);
    box-shadow: none;
}
#navAccordion .accordion-item:nth-child(4) .nav-accordion-btn:not(.collapsed) {
    color: var(--text-primary);
    background: rgba(var(--nav-admin), 0.07);
    box-shadow: none;
}

/* Offcanvas 메뉴 링크 */
.nav-offcanvas .nav-link {
    padding: 0.6rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-radius: 0;
    transition: background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.nav-offcanvas .nav-link:hover,
.nav-offcanvas .nav-link:focus {
    background: rgba(var(--primary-rgb), 0.06);
}

.nav-offcanvas .nav-link:active {
    background: rgba(var(--primary-rgb), 0.12);
}

.nav-offcanvas .nav-link.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.08);
    border-left: 3px solid var(--primary);
    padding-left: calc(1.25rem - 3px);
}

/* 사용자 메뉴 영역 */
.nav-offcanvas-user {
    background: #f8f9fa;
}

/* ===== 32. 모바일 테이블→카드 + 버튼 줄바꿈 방지 (576px 이하) ===== */
@media (max-width: 576px) {
    /* --- 테이블→카드 변환 (table-card-mobile 클래스 적용 테이블만) --- */
    .table-card-mobile thead {
        display: none;
    }

    .table-card-mobile tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--card-radius);
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        box-shadow: var(--card-shadow);
        background: var(--surface);
    }

    .table-card-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
        border: none;
        font-size: 0.9rem;
        text-align: right !important;
        padding-left: 0 !important;
    }

    .table-card-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary, #6c757d);
        font-size: 0.78rem;
        flex-shrink: 0;
        margin-right: 0.75rem;
        min-width: 4.5em;
    }

    .table-card-mobile tbody td.td-action {
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid #f0f0f0;
        margin-top: 0.25rem;
    }

    .table-card-mobile tbody td.td-action::before {
        display: none;
    }

    .table-responsive:has(.table-card-mobile) {
        overflow: visible;
    }

    /* --- 리스트 페이지 상단 버튼 텍스트 줄바꿈 방지 --- */
    .btn {
        white-space: nowrap;
    }

    .btn-sm {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ── 인쇄·PDF ── */
@media print {
    .no-print,
    nav,
    .navbar,
    footer,
    .offcanvas {
        display: none !important;
    }
    .print-show {
        display: block !important;
        opacity: 1 !important;
    }
    .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }
    canvas {
        max-height: 250px !important;
    }
    body {
        font-size: 12pt;
    }
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ── 접근성: 키보드 포커스 가시성 강화 (axe-core 2026-05-06 발견) ── */
.btn:focus-visible,
[class*="btn-outline"]:focus-visible,
.nav-link:focus-visible,
a.text-decoration-none:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.35);
}

.btn-outline-success:focus-visible { outline-color: #198754; box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.35); }
.btn-outline-danger:focus-visible  { outline-color: #dc3545; box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.35); }
.btn-outline-warning:focus-visible { outline-color: #ffc107; box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.35); }
.btn-outline-info:focus-visible    { outline-color: #0dcaf0; box-shadow: 0 0 0 0.2rem rgba(13, 202, 240, 0.35); }
.btn-outline-secondary:focus-visible { outline-color: #6c757d; box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.35); }
