/* 물품관리시스템 커스텀 스타일 */
* { box-sizing: border-box; }
html, body { height: 100%; }

.status-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600;
}
.status-in_stock    { background: #dcfce7; color: #166534; }
.status-in_use      { background: #dbeafe; color: #1e40af; }
.status-maintenance { background: #fef3c7; color: #92400e; }
.status-idle        { background: #fed7aa; color: #9a3412; font-weight:600; } /* 불용 - 주황색 강조 (처분 대기) */
.status-used        { background: #d1fae5; color: #065f46; font-weight:600; } /* 중고품 - 초록색 (재사용) */
.status-lost        { background: #fee2e2; color: #991b1b; }
.status-disposed    { background: #e5e7eb; color: #374151; }

.role-badge {
  display: inline-block; padding: 0.125rem 0.5rem;
  border-radius: 0.375rem; font-size: 0.7rem; font-weight: 700;
}
.role-super_admin { background: linear-gradient(to right, #f59e0b, #ea580c); color: white; border: 1px solid #ea580c; }
.role-admin   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.role-manager { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.role-user    { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* 사이드바 nav 아이템 */
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.875rem; border-radius: 0.5rem;
  color: #cbd5e1; cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, #385ef1, #2540e5);
  color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(56,94,241,0.35);
}
.nav-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(239,68,68,0.4);
  animation: pulse-badge 2s ease-in-out infinite;
}
/* 📱 모바일 전용 메뉴 (QR 스캔 등) - 데스크톱에서 숨김 */
/* 641px 이상 = 데스크톱 → 안 보임, ≤640px = 모바일 → 보임 */
@media (min-width: 641px) {
  .nav-item.mobile-only { display: none !important; }
}

/* ============ 📂 사이드바 그룹 (아코디언) ============ */
.nav-group {
  margin: 0.125rem 0;
}
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  border-radius: 0.4rem;
  user-select: none;
  transition: all 0.15s;
}
.nav-group-header:hover {
  background: rgba(255,255,255,0.04);
  color: #cbd5e1;
}
.nav-group-header .fa-chevron-down {
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: #64748b;
}
.nav-group.open .nav-group-header .fa-chevron-down {
  transform: rotate(0deg);
}
.nav-group:not(.open) .nav-group-header .fa-chevron-down {
  transform: rotate(-90deg);
}
.nav-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
}
.nav-group.open .nav-group-body {
  max-height: 500px;  /* 충분히 큰 값 */
}
.nav-item.nav-sub {
  margin-left: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.88rem;
}
.nav-item.nav-sub::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 0.4rem;
  height: 1px;
  background: #475569;
}
.nav-item.nav-sub:not(.active) {
  color: #e2e8f0;
}
/* 그룹 안에 active 자식이 있을 때 그룹 헤더 강조 */
.nav-group.open .nav-group-header {
  color: #cbd5e1;
}

/* 🚧 준비중 뱃지 */
.nav-pill {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-pill-soon {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

/* ============ 📱 모바일 미리보기 (데스크톱 전용) ============ */
/* FAB 버튼: 우측 하단 고정 */
.mobile-preview-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79,70,229,0.4);
  z-index: 50;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-preview-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 32px rgba(79,70,229,0.55);
}
.mobile-preview-fab:active {
  transform: translateY(0) scale(0.98);
}
/* 모바일(≤640px)에서는 숨김 - 이미 모바일 뷰라서 불필요 */
@media (max-width: 640px) {
  .mobile-preview-fab { display: none !important; }
}

/* 미리보기 패널: 우측 사이드바 */
.mobile-preview-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 50vw;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  color: white;
  z-index: 999;
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s ease-out;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.mp-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.mp-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.mp-title b { font-weight: 700; }
.mp-select {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0.4rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  margin-left: 0.4rem;
  cursor: pointer;
}
.mp-select option { background: #1e293b; color: white; }
.mp-actions {
  display: flex;
  gap: 0.3rem;
}
.mp-btn {
  width: 32px;
  height: 32px;
  border-radius: 0.4rem;
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.mp-btn:hover {
  background: rgba(255,255,255,0.15);
}
.mp-btn-close:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.mp-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 1.5rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(99,102,241,0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(236,72,153,0.08) 0%, transparent 40%);
}

/* 폰 프레임 - 아이폰 느낌 */
.mp-phone-frame {
  position: relative;
  background: #0a0a0a;
  border-radius: 40px;
  padding: 10px;
  box-shadow:
    0 0 0 2px #333,
    0 20px 50px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(255,255,255,0.1);
  transition: width 0.25s, height 0.25s;
  flex-shrink: 0;
}
.mp-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 24px;
  background: #0a0a0a;
  border-radius: 0 0 14px 14px;
  z-index: 2;
  pointer-events: none;
}
.mp-phone-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 30px;
  background: white;
  display: block;
}

.mp-footer {
  flex: 0 0 auto;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: #94a3b8;
}
.mp-footer-text i { color: #818cf8; margin-right: 0.3rem; }

/* 미리보기 열렸을 때 FAB 버튼 상태 변경 */
body.mp-active .mobile-preview-fab {
  right: calc(480px + 1.5rem);
}
body.mp-active .mobile-preview-fab::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid white;
}

/* 미리보기 패널 자체도 모바일에서는 숨김 (혹시 모를 상황 대비) */
@media (max-width: 640px) {
  .mobile-preview-panel { display: none !important; }
  body.mp-active .mobile-preview-fab { right: 1.5rem; }
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 2px 10px rgba(239,68,68,0.6); }
}

/* 카드 */
.card {
  background: white; border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

/* 테이블 */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data-table thead th {
  background: #f8fafc; color: #475569;
  text-align: left; font-weight: 600;
  padding: 0.625rem 0.75rem; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 1;
}
table.data-table tbody td { padding: 0.625rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
table.data-table tbody tr:hover { background: #f8fafc; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.875rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all .15s; border: 1px solid transparent;
}
.btn-primary   { background: #2540e5; color: white; }
.btn-primary:hover { background: #1c30cf; }
.btn-secondary { background: white; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger    { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success   { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-warning   { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-info      { background: #7c3aed; color: white; }
.btn-info:hover { background: #6d28d9; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }
.btn-sm        { padding: 0.25rem 0.625rem; font-size: 0.75rem; }

/* 입력 */
.input, .select, .textarea {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1; border-radius: 0.5rem;
  font-size: 0.875rem; background: white;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: #385ef1;
  box-shadow: 0 0 0 3px rgba(56,94,241,0.15);
}
.label { display: block; font-size: 0.8125rem; font-weight: 600; color: #475569; margin-bottom: 0.25rem; }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-body {
  background: white; border-radius: 0.75rem;
  max-width: 640px; width: 100%; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* ============ 📱 모바일 상단 바 & 사이드바 오버레이 ============ */
/* 데스크톱 기본: 상단 바 숨김, 사이드바는 항상 표시 */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}
.mobile-topbar {
  display: none;
}
.sidebar-overlay {
  display: none;
}
.mobile-sidebar-close {
  display: none;
}
.app-sidebar {
  flex-shrink: 0;
}
.app-main {
  flex: 1;
  min-width: 0;  /* flex item 오버플로 방지 */
}

/* 📱 모바일 (≤768px): 사이드바를 오프캔버스 오버레이로 */
@media (max-width: 768px) {
  .app-shell {
    display: block;  /* flex 해제 */
  }

  /* 상단 바 표시 */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #1c2984, #385ef1);
    color: white;
    padding: 0.75rem 1rem;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0));
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
  .mobile-hamburger {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 40px; height: 40px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
  }
  .mobile-hamburger:active { background: rgba(255, 255, 255, 0.3); }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
  }
  .mobile-brand-icon {
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .mobile-brand-title {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
  }
  .mobile-brand-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
    line-height: 1.2;
  }

  /* 사이드바를 오프캔버스로 (기본 숨김) */
  .app-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
  }
  .app-sidebar.is-open {
    transform: translateX(0);
  }

  /* 사이드바 오버레이 (배경 검게) */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* 사이드바 상단 닫기 X 버튼 */
  .mobile-sidebar-close {
    display: flex;
    background: transparent;
    color: #94a3b8;
    border: none;
    width: 36px; height: 36px;
    border-radius: 8px;
    align-items: center; justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
  }
  .mobile-sidebar-close:hover { color: white; background: rgba(255,255,255,0.1); }

  /* 사이드바 열렸을 때 body 스크롤 잠금 */
  body.sidebar-open {
    overflow: hidden;
  }

  /* 메인 영역: 좌측 여백 제거 (사이드바가 fixed라 흐름에 없음) */
  .app-main {
    width: 100%;
  }

  /* 페이지 패딩 축소 (모바일에선 좁게) */
  #page-container {
    padding: 0.875rem !important;
  }

  /* 헤더 폰트 크기 조정 */
  #page-container h1 {
    font-size: 1.375rem !important;
  }

  /* 카드 padding 축소 */
  .card {
    padding: 0.875rem;
  }

  /* 페이지 내 filter 그리드 (자산 검색 등)는 세로로 */
  .grid-cols-1.md\:grid-cols-4 { grid-template-columns: 1fr 1fr !important; }

  /* 데이터 테이블: 폰트 축소 + 좌우 패딩 축소 */
  .data-table {
    font-size: 0.8125rem;
  }
  .data-table th, .data-table td {
    padding: 0.5rem 0.625rem;
  }

  /* 테이블 wrap: 명시적 가로 스크롤 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============ 📱 모바일 반응형 - 폼/버튼 (≤640px) ============ */
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-body {
    /* dvh 사용: iOS Safari 주소창/하단 바 올라와도 하단 버튼 안 가려짐 */
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    max-width: 100%;
    /* iOS Safari safe-area + 추가 여유 (버튼이 홈 인디케이터 바로 위에 붙지 않도록) */
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0)) !important;
  }
  /* 폼 필드: 폰에서 손가락 터치 편하게 */
  .input, .select, .textarea {
    padding: 0.75rem 0.875rem;
    font-size: 16px;  /* iOS Safari zoom 방지 */
    min-height: 46px;
  }
  .label { font-size: 0.875rem; margin-bottom: 0.375rem; }
  /* 모든 btn 최소 44px (터치 타깃 표준) */
  .btn {
    min-height: 44px;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
  }
  .btn-sm { min-height: 38px; padding: 0.5rem 0.75rem; }
  /* 모바일 폼은 무조건 1열 */
  .grid-cols-1.md\:grid-cols-2 { grid-template-columns: 1fr !important; }
  .grid-cols-1.md\:grid-cols-3 { grid-template-columns: 1fr !important; }
  /* 상단 툴바 버튼들도 세로 정렬 */
  .flex.flex-wrap.gap-2 { gap: 0.5rem; }
}

/* ============ 📸 플로팅 액션 버튼 (모바일 현장 등재용) ============ */
.fab-quick-register {
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
  right: 1.25rem;
  z-index: 90;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2540e5, #385ef1);
  color: white; font-size: 1.5rem;
  border: none;
  box-shadow: 0 8px 20px rgba(37, 64, 229, 0.4);
  cursor: pointer;
  display: none;  /* 데스크톱에서는 숨김, 모바일에서만 표시 */
  align-items: center; justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab-quick-register:active {
  transform: scale(0.92);
  box-shadow: 0 4px 12px rgba(37, 64, 229, 0.4);
}
.fab-quick-register:hover {
  box-shadow: 0 10px 24px rgba(37, 64, 229, 0.5);
}
@media (max-width: 768px) {
  .fab-quick-register { display: flex; }
}

/* ============ 사진 미리보기 (등재 폼 안) ============ */
.photo-preview-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.photo-preview-item {
  position: relative;
  flex: 0 0 auto;
  width: 90px; height: 90px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  background: #f1f5f9;
}
.photo-preview-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-preview-item .remove {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px;
  background: rgba(220, 38, 38, 0.9);
  color: white; border: none; border-radius: 50%;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-preview-item .badge-primary {
  position: absolute; bottom: 2px; left: 2px;
  background: #059669; color: white;
  font-size: 9px; padding: 1px 5px;
  border-radius: 3px; font-weight: 600;
}
.photo-capture-tile {
  flex: 0 0 auto;
  width: 90px; height: 90px;
  border: 2px dashed #94a3b8;
  border-radius: 0.5rem;
  background: #f8fafc;
  color: #475569;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
  transition: all 0.15s;
}
.photo-capture-tile:hover {
  border-color: #385ef1;
  background: #eff3fe;
  color: #2540e5;
}
.photo-capture-tile i { font-size: 22px; margin-bottom: 4px; }

/* ============ 🎤 음성 입력 · 📷 바코드 스캔 ============ */
.input-with-voice {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-with-voice .input,
.input-with-voice .textarea {
  flex: 1;
  padding-right: 3rem;  /* 오른쪽 아이콘 공간 확보 */
}
.btn-voice {
  position: absolute;
  right: 0.375rem;
  top: 0.375rem;
  width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-voice:hover {
  background: #f1f5f9;
  color: #2540e5;
}
.btn-voice.recording {
  color: white;
  background: #dc2626;
  animation: pulse-red 1.2s infinite;
}
.btn-voice.btn-barcode { color: #059669; }
.btn-voice.btn-barcode:hover { background: #dcfce7; color: #047857; }
/* textarea (rows>=2)일 때는 우상단 코너에 붙임 */
.input-with-voice .textarea + .btn-voice {
  top: 0.375rem;
  right: 0.375rem;
}
.input-listening {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
  background: #fef2f2 !important;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* 토스트 */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 200; }
.toast {
  background: #1e293b; color: white; padding: 0.75rem 1rem;
  border-radius: 0.5rem; margin-bottom: 0.5rem; min-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #2540e5; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* QR 스캐너 */
#qr-reader { width: 100%; max-width: 400px; margin: 0 auto; }
#qr-reader video { border-radius: 0.5rem; }

/* 로그인 화면 */
.login-bg {
  background: linear-gradient(135deg, #1c2984 0%, #385ef1 50%, #5c85f8 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}

/* QR 프린트 카드 - 반응형 (모달 안에 맞춤) */
.qr-print-card {
  width: 100%;
  max-width: 260px;
  padding: 0.75rem;
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  text-align: center;
  background: white;
  margin: 0 auto;
  box-sizing: border-box;
}
.qr-print-card canvas {
  margin: 0 auto;
  display: block;
  max-width: 100%;
  height: auto;
}
.qr-print-card .qr-caption {
  word-break: break-word;
  overflow-wrap: break-word;
}

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; }
}

/* ============================================================
   PWA: 설치 버튼 & iOS 안내 배너
   ============================================================ */
.pwa-install-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: linear-gradient(135deg, #2540e5 0%, #1c30cf 100%);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(37, 64, 229, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: pwa-btn-in 0.3s ease-out;
}
.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 64, 229, 0.5);
}
.pwa-install-btn:active { transform: translateY(0); }

@keyframes pwa-btn-in {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pwa-ios-hint {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  padding: 16px;
  animation: pwa-btn-in 0.3s ease-out;
  max-width: 480px;
  margin: 0 auto;
}
.pwa-ios-hint-title {
  font-weight: 700;
  color: #1c2984;
  font-size: 15px;
  margin-bottom: 6px;
}
.pwa-ios-hint-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 10px;
}
.pwa-ios-hint-desc b { color: #2540e5; }
.pwa-ios-hint-close {
  background: #f1f5f9;
  border: none;
  color: #475569;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.pwa-ios-hint-close:hover { background: #e2e8f0; }

/* Standalone(설치 후) 모드: 상단 safe-area 여백 자동 처리 */
html.pwa-installed body {
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ═══════════════════════════════════════════════════════════════════
   📱 v2.11.1 - 모바일 전면 리뉴얼 (대표님 지시)
   - 전체 페이지 모바일 최적화
   - 테이블 → 카드 리스트 전환
   - 여백/폰트/버튼/모달 전면 조정
   ═══════════════════════════════════════════════════════════════════ */

/* 📱 모바일 공통 (max-width: 768px) */
@media (max-width: 768px) {
  /* 기본 폰트 가독성 향상 */
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }

  /* 상단 헤더 */
  .mobile-header {
    padding: 0.75rem 1rem !important;
  }
  .mobile-header h1,
  .mobile-header .title {
    font-size: 0.95rem !important;
    line-height: 1.3;
  }

  /* 메인 컨테이너 패딩 축소 */
  #page-container {
    padding: 0.75rem !important;
  }

  /* 카드 공통 */
  .card {
    padding: 0.875rem !important;
    border-radius: 10px;
    margin-bottom: 0.75rem;
  }
  .card.p-3, .card.p-4, .card.p-5, .card.p-6 {
    padding: 0.875rem !important;
  }

  /* 타이틀/서브타이틀 */
  h1.text-2xl, h2.text-2xl { font-size: 1.25rem !important; }
  h1.text-xl, h2.text-xl { font-size: 1.1rem !important; }
  .text-sm { font-size: 0.85rem !important; }

  /* 버튼 터치 영역 확보 (44x44px 최소) */
  .btn {
    min-height: 40px;
    padding: 0.5rem 0.875rem;
    font-size: 0.9rem;
  }
  .btn-sm {
    min-height: 36px;
    padding: 0.375rem 0.625rem;
    font-size: 0.825rem;
  }

  /* input/select/textarea 터치 */
  .input, .select, .textarea {
    min-height: 42px;
    font-size: 16px; /* iOS 자동 줌 방지 */
    padding: 0.5rem 0.75rem;
  }
  .textarea { min-height: unset; }

  /* 테이블 → 카드 리스트 전환 (data-table.mobile-cards 클래스 적용 시) */
  .data-table.mobile-cards { display: block; }
  .data-table.mobile-cards thead { display: none; }
  .data-table.mobile-cards tbody,
  .data-table.mobile-cards tr,
  .data-table.mobile-cards td { display: block; }
  .data-table.mobile-cards tr {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.625rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  }
  .data-table.mobile-cards td {
    padding: 0.25rem 0 !important;
    border: none !important;
    font-size: 0.875rem;
  }
  .data-table.mobile-cards td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #64748b;
    display: inline-block;
    min-width: 60px;
    font-size: 0.8rem;
  }
  /* 라벨 숨김 플래그 */
  .data-table.mobile-cards td[data-label=""]::before,
  .data-table.mobile-cards td.no-label::before { content: ""; min-width: 0; }

  /* table-wrap 가로 스크롤 제거 (카드모드일 때) */
  .table-wrap:has(.mobile-cards) { overflow: visible; }

  /* 모달: 최대 폭 100% + 양 사이드 여백 */
  .modal-overlay > .modal-body,
  .modal-backdrop > .modal-content {
    max-width: calc(100vw - 1rem) !important;
    max-height: 92dvh !important;
    margin: 0.5rem;
    padding: 1rem !important;
  }

  /* 그리드: md:grid-cols-2 → 모바일 1열 강제 */
  .mobile-stack .grid { grid-template-columns: 1fr !important; }
  .mobile-1col { grid-template-columns: 1fr !important; }

  /* 상단 액션 버튼 영역: 가로 스크롤 지원 */
  .mobile-action-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-action-bar::-webkit-scrollbar { display: none; }
  .mobile-action-bar > .btn { flex-shrink: 0; }

  /* 필터 영역 압축 */
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .filter-bar > * { min-width: 0; }
  .filter-bar > .btn { grid-column: span 1; }
  .filter-bar > .input-full { grid-column: 1 / -1; }

  /* 통계 카드 그리드 */
  .stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .stats-grid .stat-card {
    padding: 0.75rem !important;
  }
  .stats-grid .stat-value { font-size: 1.5rem !important; }
  .stats-grid .stat-label { font-size: 0.75rem !important; }

  /* 차트 영역: 높이 최대 220px */
  .chart-wrap { max-height: 220px !important; height: 220px !important; position: relative; }
  .chart-wrap canvas { max-height: 220px !important; }

  /* 카드 리스트용 공통 스타일 */
  .m-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.625rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  .m-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }
  .m-card-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
  .m-card-subtitle { font-size: 0.75rem; color: #64748b; }
  .m-card-body { font-size: 0.825rem; color: #475569; }
  .m-card-body > div { margin: 0.125rem 0; }
  .m-card-body .label { color: #94a3b8; font-size: 0.7rem; margin-right: 0.25rem; }
  .m-card-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
  }
  .m-card-actions .btn { flex: 1; min-width: 0; font-size: 0.8rem; }

  /* 뱃지 가독성 */
  .status-badge, .badge {
    font-size: 0.72rem !important;
    padding: 2px 6px !important;
  }

  /* 사이드바 열렸을 때 메인 가림 방지 (overlay) */
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 39;
  }

  /* FAB 위치: 하단 네비바 피해서 */
  .mobile-preview-fab,
  .fab-camera {
    bottom: 1.25rem !important;
    right: 1rem !important;
    width: 52px !important;
    height: 52px !important;
  }

  /* 상세 모달 내부 필드 그리드 */
  .detail-field-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .detail-field-grid > div {
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
  }
  .detail-field-grid .label {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 0.125rem;
  }
  .detail-field-grid .value {
    font-size: 0.9rem;
    color: #0f172a;
    font-weight: 500;
  }

  /* 상세 모달 액션 버튼 2열 그리드 */
  .detail-action-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    margin-bottom: 1rem;
  }
  .detail-action-grid > .btn {
    width: 100% !important;
    flex: unset !important;
    font-size: 0.8rem;
  }
}

/* 작은 모바일 (iPhone SE 등) */
@media (max-width: 380px) {
  body { font-size: 14px; }
  .card { padding: 0.625rem !important; }
  .btn { font-size: 0.825rem; padding: 0.4rem 0.6rem; }
  .btn-sm { font-size: 0.75rem; padding: 0.3rem 0.5rem; }
  h1.text-2xl, h2.text-2xl { font-size: 1.1rem !important; }
}

/* 📱 모바일: 데이터 테이블 가로 스크롤 힌트 (mobile-cards 없는 테이블용) */
@media (max-width: 768px) {
  .table-wrap:not(:has(.mobile-cards)) {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap:not(:has(.mobile-cards))::after {
    content: "← 좌우로 스크롤 →";
    display: block;
    text-align: center;
    font-size: 0.65rem;
    color: #94a3b8;
    padding: 0.25rem 0;
    pointer-events: none;
  }
  .table-wrap:not(:has(.mobile-cards)) table {
    min-width: max-content;
    font-size: 0.825rem;
  }
  .table-wrap:not(:has(.mobile-cards)) th,
  .table-wrap:not(:has(.mobile-cards)) td {
    padding: 0.5rem 0.625rem;
    white-space: nowrap;
  }
}
