/* =====================================================================
   아이폰 통관 & 지재권 조회 서비스 완벽 통합 및 스코프 분리 스타일시트
   - 버전: v2.3 (클래스 충돌 원천 차단 및 기기별 반응형 복원)
   - 스코프:
       1) Global Base & Shared Utilities
       2) body.public-page (메인 조회 & 공개 통계)
       3) body.admin-page (관리자 M B/L 일괄 스캔)
       4) body.admin-stats-page (관리자 종합 통계 관제 대시보드)
   ===================================================================== */

/* -------------------------------------------------------------
   1. 글로벌 기본 설정 & 리셋 (Global Base & Reset)
------------------------------------------------------------- */
:root {
  color-scheme: light;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  color: #172033;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f8fafc;
  color: #172033;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* 스크롤바 미려화 공통 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 공통 반응형 유틸리티: .hide-mob, .hide-tablet은 미디어 쿼리에서 display:none 처리됨 */
.show-mob {
  display: none !important;
}

/* 선박별 적발 현황 테이블 */
.vessel-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 13.5px;
}

.vessel-table th,
.vessel-table td {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

.vessel-table thead th {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 12.5px;
  color: #475569;
}

.vessel-table tbody tr:hover {
  background: #f8fafc;
}

.vessel-table tbody td {
  background: #fff;
}

@media (max-width: 640px) {
  .vessel-table th,
  .vessel-table td {
    padding: 7px 8px;
    font-size: 12.5px;
  }
}

.badge-rate {
  font-weight: 800;
  color: #dc2626;
}

.badge-rate.safe {
  color: #059669;
}

.kw-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap !important;
  box-sizing: border-box;
  line-height: 1.2;
}

.kw-tag span {
  white-space: nowrap;
}

.kw-tag b {
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.85;
}

.kw-tag.normal {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.kw-tag.seized {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.sample-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}

.sample-badge.high {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.sample-badge.ok {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.sample-badge.low {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.mode-toggle-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.mode-toggle-btn:hover {
  color: #0f172a;
}

.mode-toggle-btn.active {
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* -------------------------------------------------------------
   2. [PAGE 1] 메인 조회 & 공개 통계 페이지 (body.public-page)
------------------------------------------------------------- */
body.public-page .topbar {
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

body.public-page .topbar-inner {
  width: min(1120px, calc(100% - 40px));
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.public-page .brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.public-page .logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: #2563eb;
  font-weight: 800;
  font-size: 16px;
}

body.public-page .brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

body.public-page .brand small {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

body.public-page .nav-admin-link {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.public-page .nav-admin-link:hover {
  color: #1e293b;
  background: #f1f5f9;
  border-color: #94a3b8;
}

body.public-page main {
  width: min(1120px, calc(100% - 40px));
  margin: 40px auto 80px;
}

body.public-page .hero {
  text-align: center;
  margin-bottom: 36px;
}

body.public-page .hero-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

body.public-page h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.04em;
  color: #0f172a;
}

body.public-page .hero p {
  margin: 0;
  color: #64748b;
  font-size: 15px;
}

/* 운송장 단건 조회 폼 */
body.public-page .search-box-wrap {
  max-width: 680px;
  margin: 0 auto 40px;
  background: #ffffff;
  padding: 24px 28px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(30, 41, 59, 0.05);
}

body.public-page .search-label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #1e293b;
}

body.public-page .input-row {
  display: flex;
  gap: 10px;
}

body.public-page .input-hbl {
  flex: 1;
  padding: 14px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #ffffff;
  color: #0f172a;
}

body.public-page .input-hbl:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

body.public-page .btn-search {
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color .2s;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.public-page .btn-search:hover {
  background: #1d4ed8;
}

body.public-page .btn-search:disabled {
  background: #94a3b8;
  cursor: wait;
}

/* 조회 결과 카드 */
body.public-page #hbl-result {
  display: none;
  margin-top: 24px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

body.public-page .result-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

body.public-page .status-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.public-page .status-badge.safe {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

body.public-page .status-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecdd3;
}

body.public-page .status-badge.pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

body.public-page .status-badge.in_progress {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* 진행 단계 스테퍼 (Step Progress) */
body.public-page .stepper-wrap {
  margin: 18px 0;
  padding: 16px 12px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

body.public-page .stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

body.public-page .step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
  text-align: center;
}

body.public-page .step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
  transition: all .2s;
}

body.public-page .step-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

body.public-page .step-item.active .step-icon {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

body.public-page .step-item.active .step-label {
  color: #1d4ed8;
  font-weight: 800;
}

body.public-page .step-item.completed .step-icon {
  background: #10b981;
  color: #ffffff;
}

body.public-page .step-item.completed .step-label {
  color: #047857;
}

body.public-page .step-item.blocked .step-icon {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

body.public-page .step-item.blocked .step-label {
  color: #dc2626;
  font-weight: 800;
}

body.public-page .stepper-line {
  position: absolute;
  top: 16px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: #e2e8f0;
  z-index: 0;
}

body.public-page .stepper-fill {
  height: 100%;
  background: #10b981;
  transition: width .3s;
}

body.public-page .stepper-fill.blocked {
  background: #ef4444;
}

/* 세부 정보 그리드 */
body.public-page .info-sec-title {
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.public-page .grid-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 13px;
}

body.public-page .grid-info div {
  background: #f8fafc;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

body.public-page .grid-info span {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 3px;
  font-weight: 600;
}

body.public-page .grid-info strong {
  color: #0f172a;
  font-weight: 700;
  word-break: break-all;
}

body.public-page .timeline-list {
  margin-top: 18px;
  border-top: 1px solid #e2e8f0;
  padding-top: 14px;
}

body.public-page .timeline-list h4 {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: #1e293b;
  font-weight: 800;
}

body.public-page .timeline-item {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 7px 0;
  border-bottom: 1px dashed #f1f5f9;
  color: #334155;
}

body.public-page .timeline-item:last-child {
  border-bottom: none;
}

/* 공개 통계 섹션 */
body.public-page .section-divider {
  border: 0;
  height: 1px;
  background: #e2e8f0;
  margin: 48px 0;
}

body.public-page .stats-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #0f172a;
}

body.public-page .stats-sub {
  color: #64748b;
  font-size: 13.5px;
  margin-bottom: 20px;
}

/* 공개 통계 4분할 카드 그리드 (PC에서 4열) */
body.public-page .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

body.public-page .card {
  padding: 18px 20px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

body.public-page .card span {
  font-size: 12px;
  color: #64748b;
}

body.public-page .card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

body.public-page .two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

body.public-page .table-wrap {
  padding: 20px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.public-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

body.public-page th,
body.public-page td {
  padding: 10px 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
}

body.public-page th:first-child,
body.public-page td:first-child {
  text-align: left;
}

body.public-page th {
  color: #64748b;
  font-size: 12px;
}

/* 관할 세관별 실시간 노선 실태 테이블 & 뱃지 */
.public-port-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.public-port-table th,
.public-port-table td {
  vertical-align: middle;
  box-sizing: border-box;
}

.public-port-table .col-port-name { width: 22%; }
.public-port-table .col-port-total { width: 15%; }
.public-port-table .col-port-seized { width: 16%; }
.public-port-table .col-port-normal { width: 15%; }
.public-port-table .col-port-status { width: 32%; }

.port-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
}

.port-status-badge.badge-incheon {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 800;
}

.port-status-badge.badge-pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 800;
}

.port-status-badge.badge-suspended {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* -------------------------------------------------------------
   3. [PAGE 2] 관리자 M B/L 일괄 스캔 페이지 (body.admin-page)
------------------------------------------------------------- */
body.admin-page {
  background: #f4f7fb;
}

body.admin-page .topbar {
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e6ebf2;
  background: #ffffff;
}

body.admin-page .topbar-inner {
  width: min(1120px, calc(100% - 40px));
  margin: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

body.admin-page .logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: #dc2626;
  font-weight: 800;
  font-size: 16px;
}

body.admin-page .brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

body.admin-page .brand small {
  display: block;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

body.admin-page .nav-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.admin-page .nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s;
  border: 1px solid transparent;
}

body.admin-page .nav-btn.active {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fee2e2;
}

body.admin-page .nav-btn:not(.active) {
  color: #64748b;
  background: #ffffff;
  border-color: #e2e8f0;
}

body.admin-page .nav-btn:not(.active):hover {
  color: #1e293b;
  background: #f8fafc;
}

body.admin-page .nav-btn.primary {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

body.admin-page .nav-btn.logout {
  color: #94a3b8;
  font-size: 12px;
  border: 1px solid #cbd5e1;
}

body.admin-page .nav-btn.logout:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #ffffff;
}

body.admin-page main {
  width: min(1120px, calc(100% - 40px));
  margin: 40px auto;
}

body.admin-page .hero {
  margin-bottom: 24px;
}

body.admin-page .eyebrow {
  color: #dc2626;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}

body.admin-page h1 {
  margin: 6px 0 10px;
  font-size: 32px;
  letter-spacing: -0.05em;
}

body.admin-page .hero p {
  margin: 0;
  color: #66748a;
  font-size: 14px;
}

/* 수집된 M B/L 큐 알림 카드 */
body.admin-page .collected-box {
  margin-bottom: 24px;
  padding: 20px 24px;
  border-radius: 16px;
  background: #ffffff;
  border: 1.5px solid #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.08);
}

body.admin-page .collected-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

body.admin-page .collected-box-head h3 {
  margin: 0;
  font-size: 15.5px;
  color: #1d4ed8;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body.admin-page .btn-batch-add {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

body.admin-page .btn-batch-add:hover {
  background: #1d4ed8;
}

body.admin-page .collected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.admin-page .collected-tag {
  padding: 6px 10px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.admin-page .btn-del-mbl {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.admin-page .btn-del-mbl:hover {
  color: #dc2626;
  background: #fee2e2;
}

body.admin-page .btn-clear-all {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.admin-page .btn-clear-all:hover {
  background: #fee2e2;
}

body.admin-page .layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

body.admin-page .card {
  border: 1px solid #e3e9f1;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.05);
}

body.admin-page .form-card {
  padding: 28px;
}

body.admin-page label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 800;
}

body.admin-page label span {
  color: #91a0b4;
  font-weight: 500;
}

body.admin-page textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 16px;
  border: 1px solid #d8e0eb;
  border-radius: 12px;
  outline: none;
  color: #172033;
  font: inherit;
  line-height: 1.6;
}

body.admin-page textarea:focus {
  border-color: #2563eb;
}

body.admin-page .hint {
  margin: 8px 0 18px;
  color: #8491a4;
  font-size: 12.5px;
}

body.admin-page button.btn-submit {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 11px;
  color: #ffffff;
  background: #2563eb;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 48px;
}

body.admin-page button.btn-submit:hover {
  background: #1d4ed8;
}

body.admin-page button.btn-submit:disabled {
  cursor: wait;
  opacity: .6;
}

body.admin-page .side-card {
  padding: 24px;
}

body.admin-page .side-card h2 {
  margin: 0 0 16px;
  font-size: 16px;
}

body.admin-page .step {
  display: flex;
  gap: 12px;
  margin: 14px 0;
  color: #65748b;
  font-size: 13px;
  line-height: 1.4;
}

body.admin-page .step b {
  flex: 0 0 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2563eb;
  background: #eaf1ff;
  font-size: 12px;
}

body.admin-page #results {
  display: none;
  margin-top: 20px;
  padding: 24px;
}

body.admin-page #results.visible {
  display: block;
}

body.admin-page .result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

body.admin-page .result-head h2 {
  margin: 0;
  font-size: 18px;
}

body.admin-page .result-head span {
  color: #8290a5;
  font-size: 13px;
}

body.admin-page .job {
  padding: 15px 0;
  border-top: 1px solid #edf0f5;
}

body.admin-page .job-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

body.admin-page .job-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

body.admin-page .badge {
  padding: 4px 9px;
  border-radius: 99px;
  color: #64748b;
  background: #f1f5f9;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 700;
}

body.admin-page .badge.running {
  color: #1d4ed8;
  background: #eaf1ff;
}

body.admin-page .badge.completed {
  color: #047857;
  background: #dff8ef;
}

body.admin-page .badge.failed {
  color: #b91c1c;
  background: #fee7e7;
}

body.admin-page .job-meta {
  margin-top: 8px;
  color: #8290a5;
  font-size: 12px;
}

body.admin-page .job-phase {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: #53647b;
  font-size: 13px;
  font-weight: 700;
}

body.admin-page .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 5px #eaf1ff;
  animation: pulse 1.5s infinite;
}

body.admin-page .progress {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1f6;
}

body.admin-page .progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width .3s;
}

body.admin-page .updated {
  margin-top: 8px;
  color: #a0abba;
  font-size: 11px;
}

body.admin-page .events {
  margin-top: 14px;
  max-height: 220px;
  overflow: auto;
  border-top: 1px solid #edf0f5;
}

body.admin-page .event {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f3f6;
  font-size: 12px;
}

body.admin-page .event b {
  color: #8290a5;
  font-weight: 600;
}

body.admin-page .event strong {
  display: block;
  color: #53647b;
  font-size: 12px;
}

body.admin-page .event small {
  color: #9aa6b6;
}

@keyframes pulse {
  50% {
    opacity: .35;
    transform: scale(.8);
  }
}

body.admin-page .download {
  display: inline-block;
  margin-top: 10px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

body.admin-page .error {
  margin-top: 8px;
  color: #b91c1c;
  font-size: 12px;
}

body.admin-page .menu-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

body.admin-page .menu-toggle:hover {
  background: #f8fafc;
}

/* -------------------------------------------------------------
   4. [PAGE 3] 관리자 통계 대시보드 (body.admin-stats-page)
------------------------------------------------------------- */
body.admin-stats-page {
  background: #f4f7fb;
}

body.admin-stats-page .topbar {
  height: 72px;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #e6ebf2;
}

body.admin-stats-page .topbar-inner {
  width: min(1120px, calc(100% - 40px));
  margin: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

body.admin-stats-page .brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.admin-stats-page .logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: #dc2626;
  font-weight: 800;
}

body.admin-stats-page .brand {
  font-size: 18px;
  font-weight: 800;
}

body.admin-stats-page .brand small {
  display: block;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
}

body.admin-stats-page .nav-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.admin-stats-page .nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s;
  border: 1px solid transparent;
}

body.admin-stats-page .nav-btn.active {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fee2e2;
}

body.admin-stats-page .nav-btn:not(.active) {
  color: #64748b;
  background: #ffffff;
  border-color: #e2e8f0;
}

body.admin-stats-page .nav-btn:not(.active):hover {
  color: #1e293b;
  background: #f8fafc;
}

body.admin-stats-page .nav-btn.primary {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

body.admin-stats-page .nav-btn.logout {
  color: #94a3b8;
  font-size: 12px;
  border: 1px solid #cbd5e1;
}

body.admin-stats-page .nav-btn.logout:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #ffffff;
}

body.admin-stats-page .menu-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

body.admin-stats-page .menu-toggle:hover {
  background: #f8fafc;
}

body.admin-stats-page main {
  width: min(1120px, calc(100% - 40px));
  margin: 36px auto 0;
  padding-bottom: 60px;
}

body.admin-stats-page h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: -0.05em;
}

body.admin-stats-page h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

body.admin-stats-page .lead {
  color: #66748a;
  font-size: 13.5px;
}

body.admin-stats-page .note {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
  font-size: 13.5px;
}

/* 표본 수 신뢰도 자동 최적화 안내 카드 (White Box 컨테이너) */
body.admin-stats-page .confidence-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 20px 0 !important;
  padding: 16px 20px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e3e9f1;
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.05);
  box-sizing: border-box;
}

body.admin-stats-page .confidence-filter-bar .confidence-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body.admin-stats-page .confidence-filter-bar .confidence-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
  line-height: 1;
}

body.admin-stats-page .confidence-filter-bar .confidence-bar-right {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #64748b;
  line-height: 1;
}

.copy-icon {
  display: inline-flex;
  align-items: center;
  transition: transform .15s, color .15s;
}

.copy-icon:hover {
  color: #2563eb;
  transform: scale(1.1);
}

.mbl-collapsible summary {
  list-style: none;
}

.mbl-collapsible summary::-webkit-details-marker {
  display: none;
}

/* 관리자 대시보드 6분할 카드 그리드 */
body.admin-stats-page .cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin: 20px 0;
}

body.admin-stats-page .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
  border: 1px solid #e3e9f1;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.05);
  min-width: 0;
}

body.admin-stats-page .card span {
  display: block;
  color: #8290a5;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

body.admin-stats-page .card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1;
}

body.admin-stats-page .table-wrap,
body.admin-stats-page .chart-wrap {
  padding: 20px;
  border: 1px solid #e3e9f1;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.05);
  margin-top: 18px;
}

body.admin-stats-page .table-wrap {
  overflow-x: auto;
}

body.admin-stats-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

body.admin-stats-page th,
body.admin-stats-page td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf0f5;
  text-align: right;
  white-space: nowrap;
}

body.admin-stats-page th:first-child,
body.admin-stats-page td:first-child {
  text-align: left;
  white-space: normal;
  word-break: keep-all;
}

/* M B/L 전용 테이블 2번째 열(상태) 중앙 정렬 */
body.admin-stats-page .mbl-collapsible th:nth-child(2),
body.admin-stats-page .mbl-collapsible td:nth-child(2) {
  text-align: center;
}

/* 개별 화물 상세 추적 테이블 전용 스타일 */
body.admin-stats-page .cargo-detail-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

body.admin-stats-page .cargo-detail-table th,
body.admin-stats-page .cargo-detail-table td {
  text-align: left;
  vertical-align: middle;
  padding: 7.5px 8px !important;
  line-height: 1.35;
  box-sizing: border-box;
}

body.admin-stats-page .cargo-detail-table th {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 9px 8px !important;
}

body.admin-stats-page .cargo-detail-table td {
  border-bottom: 1px solid #edf0f5;
}

body.admin-stats-page .cargo-detail-table tbody tr:hover {
  background-color: #f8fafc;
}

/* 개별 화물 상세 추적 테이블 컬럼 비율 (PC 100% 최적 분배) */
body.admin-stats-page .cargo-detail-table .col-hbl {
  width: 15% !important;
  white-space: nowrap !important;
}

body.admin-stats-page .cargo-detail-table .col-product {
  width: 23% !important;
}

body.admin-stats-page .cargo-detail-table .col-forwarder {
  width: 15% !important;
}

body.admin-stats-page .cargo-detail-table .col-port {
  width: 6% !important;
  text-align: center !important;
}

body.admin-stats-page .cargo-detail-table .col-stage {
  width: 16% !important;
}

body.admin-stats-page .cargo-detail-table .col-time {
  width: 14% !important;
}

body.admin-stats-page .cargo-detail-table .col-status {
  width: 11% !important;
  text-align: center !important;
}

body.admin-stats-page .two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* 2열 내부 카드 컨테이너: 테이블 내용이 잘리지 않고 유연하게 배치 */
body.admin-stats-page .two-col .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.admin-stats-page .two-col .inner-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.admin-stats-page .two-col table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

body.admin-stats-page .two-col table th,
body.admin-stats-page .two-col table td {
  padding: 8px 6px;
  font-size: 12px;
  text-align: right;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

body.admin-stats-page .two-col table th:first-child,
body.admin-stats-page .two-col table td:first-child {
  text-align: left;
  padding-right: 12px;
  padding-left: 4px;
  white-space: nowrap;
  font-weight: 700;
  overflow: visible;
  text-overflow: clip;
}

body.admin-stats-page .two-col table th.col-sample,
body.admin-stats-page .two-col table td.col-sample {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

body.admin-stats-page .two-col .sample-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

body.admin-stats-page th {
  color: #8290a5;
  font-size: 12px;
}

body.admin-stats-page .empty {
  color: #8290a5;
  padding: 30px 0;
  text-align: center;
}

body.admin-stats-page .bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  border-bottom: 2px solid #e3e9f1;
}

body.admin-stats-page .bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

body.admin-stats-page .bar {
  width: 100%;
  background: #dc2626;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  transition: background-color .15s;
}

body.admin-stats-page .bar-zero {
  opacity: .2;
}

body.admin-stats-page .bar:hover {
  background: #b91c1c;
}

body.admin-stats-page .bar-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #172033;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

body.admin-stats-page .bar:hover .bar-tip {
  display: block;
}

body.admin-stats-page .btn-refresh {
  padding: 8px 14px;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

body.admin-stats-page .btn-refresh:hover {
  background: #f8fafc;
  border-color: #2563eb;
  color: #2563eb;
}

body.admin-stats-page .title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* 대형 테이블 가상화 & 고정 폭 렌더링 */
body.admin-stats-page #item-rows tr {
  content-visibility: auto;
  contain-intrinsic-size: 0 38px;
}

/* -------------------------------------------------------------
   5. 반응형 미디어 쿼리 (태블릿: 1024px 이하)
------------------------------------------------------------- */
@media (max-width: 1024px) {

  /* 태블릿 숨김 유틸리티 */
  .hide-tablet {
    display: none !important;
  }

  /* 컨테이너 너비 */
  body.public-page main,
  body.public-page .topbar-inner,
  body.admin-page main,
  body.admin-stats-page main {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
  }

  /* 관리자 탑바 태블릿 & 모바일 반응형 내비게이션 (1024px 이하) */
  body.admin-page .topbar,
  body.admin-stats-page .topbar {
    height: auto !important;
    min-height: 64px !important;
    padding: 12px 0 !important;
  }

  body.admin-page .topbar-inner,
  body.admin-stats-page .topbar-inner {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  body.admin-page .brand-wrap,
  body.admin-stats-page .brand-wrap {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  body.admin-page .menu-toggle,
  body.admin-stats-page .menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #1e293b !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }

  body.admin-page .nav-group,
  body.admin-stats-page .nav-group {
    display: none !important;
    width: 100% !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }

  body.admin-page .nav-group.open,
  body.admin-stats-page .nav-group.open {
    display: flex !important;
  }

  body.admin-page .nav-btn,
  body.admin-stats-page .nav-btn {
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
    justify-content: flex-start !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    min-height: 44px !important;
  }

  body.admin-page .nav-btn.logout,
  body.admin-stats-page .nav-btn.logout {
    margin-top: 4px !important;
    justify-content: center !important;
    font-weight: 800 !important;
  }

  /* 2열 레이아웃 1열 스택 */
  body.public-page .two-col,
  body.admin-stats-page .two-col {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* 카드 그리드 태블릿 */
  body.public-page .cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  body.admin-stats-page .cards {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  /* 관리자 스캐너 페이지 태블릿 */
  body.admin-page .layout {
    grid-template-columns: 1fr !important;
  }

  body.admin-page .side-card {
    display: block !important;
    margin-top: 14px !important;
  }

  /* 테이블 컨테이너 및 폰트 */
  body.public-page .table-wrap,
  body.admin-stats-page .table-wrap {
    padding: 16px 14px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.public-page table,
  body.admin-stats-page table {
    font-size: 12px !important;
  }

  body.public-page th,
  body.public-page td,
  body.admin-stats-page th,
  body.admin-stats-page td {
    padding: 8px 6px !important;
  }

  /* 상세 테이블 태블릿 컬럼 (균형 비율 100%) - 마지막단계 확대(26%) */
  body.admin-stats-page .cargo-detail-table .col-hbl,
  .cargo-detail-table .col-hbl {
    width: 18% !important;
  }

  body.admin-stats-page .cargo-detail-table .col-product,
  .cargo-detail-table .col-product {
    width: 22% !important;
  }

  body.admin-stats-page .cargo-detail-table .col-stage,
  .cargo-detail-table .col-stage {
    width: 26% !important;
    padding-right: 12px !important;
  }

  body.admin-stats-page .cargo-detail-table .col-time,
  .cargo-detail-table .col-time {
    width: 17% !important;
    padding-left: 6px !important;
  }

  body.admin-stats-page .cargo-detail-table .col-status,
  .cargo-detail-table .col-status {
    width: 17% !important;
  }

  /* 관리자 테이블 툴바 태블릿 */
  .admin-table-toolbar {
    gap: 10px !important;
  }

  .admin-table-controls #filter-search-input {
    width: 260px !important;
    min-height: 40px !important;
  }

  .admin-table-controls #filter-status-select {
    min-height: 40px !important;
  }

  /* 스테퍼 태블릿 */
  body.public-page .stepper-wrap {
    padding: 14px 10px !important;
  }

  body.public-page .step-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
  }

  body.public-page .step-label {
    font-size: 10.5px !important;
  }
}

/* -------------------------------------------------------------
   6. 반응형 미디어 쿼리 (모바일: 768px 이하)
------------------------------------------------------------- */
@media (max-width: 768px) {

  /* 모바일 숨김 유틸리티 */
  /* 모바일 숨김/표시 유틸리티 */
  .hide-mob {
    display: none !important;
  }

  .show-mob {
    display: inline !important;
  }

  /* 전체 뷰포트 여백 */
  body.public-page main,
  body.admin-page main,
  body.admin-stats-page main {
    width: calc(100% - 20px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-bottom: 40px !important;
  }

  body.public-page .topbar-inner {
    width: calc(100% - 20px) !important;
  }

  body.admin-page .topbar-inner,
  body.admin-stats-page .topbar-inner {
    width: calc(100% - 20px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
  }

  /* 탑바 네비게이션 모바일 */
  .topbar {
    height: auto !important;
    padding: 12px 0 !important;
  }

  .brand-wrap {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }

  .brand {
    font-size: 15px !important;
  }

  .brand small {
    font-size: 10px !important;
  }

  .menu-toggle {
    display: inline-flex !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  .nav-group {
    display: none !important;
    width: 100% !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px solid #f1f5f9 !important;
  }

  .nav-group.open {
    display: flex !important;
  }

  .nav-btn {
    width: 100% !important;
    text-align: left !important;
    justify-content: flex-start !important;
    font-size: 13.5px !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    min-height: 44px !important;
  }

  .nav-btn.logout {
    margin-top: 4px !important;
    justify-content: center !important;
    font-weight: 800 !important;
  }

  /* 히어로 섹션 모바일 */
  .hero {
    margin-bottom: 18px !important;
  }

  .hero h1 {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }

  .hero p {
    font-size: 12.5px !important;
    line-height: 1.5 !important;
  }

  /* 검색창 폼 모바일 */
  .search-box-wrap {
    padding: 16px 12px !important;
    border-radius: 12px !important;
    margin-bottom: 18px !important;
  }

  .input-row {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .input-hbl {
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    min-height: 46px !important;
    border-radius: 10px !important;
  }

  .btn-search {
    width: 100% !important;
    padding: 12px !important;
    font-size: 14.5px !important;
    min-height: 46px !important;
    border-radius: 10px !important;
    font-weight: 800 !important;
  }

  /* 타이틀 행 모바일 */
  .title-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .title-row h1 {
    font-size: 20px !important;
  }

  .title-row>div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  #btn-open-tiktok,
  .btn-refresh {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    font-size: 13.5px !important;
    padding: 11px 14px !important;
  }

  /* 요약 지표 카드 모바일 */
  .cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .card {
    padding: 12px 10px !important;
    border-radius: 12px !important;
  }

  .card span {
    font-size: 11px !important;
  }

  .card strong {
    font-size: 19px !important;
    margin-top: 2px !important;
  }

  /* 진행 단계 스테퍼 (Step Progress) 모바일 압축 */
  body.public-page .stepper-wrap {
    padding: 12px 6px !important;
    border-radius: 10px !important;
    margin: 14px 0 !important;
  }

  body.public-page .step-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
    margin-bottom: 3px !important;
  }

  body.public-page .step-label {
    font-size: 9.5px !important;
    word-break: keep-all !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    max-width: 58px !important;
  }

  /* 상세 정보 그리드 모바일 1열 스택 */
  body.public-page .grid-info {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.public-page .grid-info div {
    padding: 9px 12px !important;
  }

  /* 타임라인 항목 모바일 */
  body.public-page .timeline-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    padding: 6px 0 !important;
  }

  /* 관리자 관제 페이지 상세 테이블 모바일 최적화 */
  /* 차트 헤더 & 항구 선택 모바일 */
  .chart-header-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  #port-selector-wrap {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  #port-chart-select {
    flex: 1 !important;
    min-height: 38px !important;
    font-size: 13px !important;
  }

  /* 신뢰도 필터 모드 버튼 모바일 */
  #dataset-mode-switch {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
  }

  #dataset-mode-switch .mode-toggle-btn {
    width: 100% !important;
    min-height: 38px !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 12.5px !important;
  }

  /* 관리자 관제 페이지 상세 테이블 모바일 최적화 (황금비율: 44% / 32% / 24%) */
  body.admin-stats-page .cargo-detail-table,
  .cargo-detail-table {
    table-layout: fixed !important;
    width: 100% !important;
  }

  body.admin-stats-page .cargo-detail-table .col-hbl,
  .cargo-detail-table .col-hbl {
    width: 44% !important;
  }

  body.admin-stats-page .cargo-detail-table .col-product,
  .cargo-detail-table .col-product {
    width: 32% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
  }

  body.admin-stats-page .cargo-detail-table .col-status,
  .cargo-detail-table .col-status {
    width: 24% !important;
    text-align: right !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  body.admin-stats-page .cargo-detail-table col.hide-mob,
  body.admin-stats-page .cargo-detail-table col.hide-tablet,
  .cargo-detail-table col.hide-mob,
  .cargo-detail-table col.hide-tablet {
    width: 0 !important;
    display: none !important;
  }

  body.admin-stats-page .cargo-detail-table td.col-hbl .hbl-cell-wrap,
  .cargo-detail-table td.col-hbl .hbl-cell-wrap {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
  }

  body.admin-stats-page .cargo-detail-table td.col-status .badge-sub-before-decl,
  .cargo-detail-table td.col-status .badge-sub-before-decl {
    display: block !important;
    margin-left: 0 !important;
    margin-top: 1px !important;
    font-size: 9.5px !important;
    text-align: right !important;
  }

  body.admin-stats-page .cargo-detail-table th,
  body.admin-stats-page .cargo-detail-table td,
  .cargo-detail-table th,
  .cargo-detail-table td {
    padding: 6.5px 4px !important;
    font-size: 11px !important;
  }

  /* 관리자 테이블 검색 & 필터 모바일 100% 폭 스택 */
  .admin-table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  .admin-table-title {
    font-size: 15px !important;
  }

  .admin-table-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  #filter-search-input {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
  }

  #filter-status-select {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
  }

  #filter-count-badge {
    display: block !important;
    text-align: right !important;
    font-size: 11.5px !important;
    margin-top: 2px !important;
  }

  /* 틱톡 모달 모바일 최적화 */
  #tiktok-modal {
    padding: 10px !important;
  }

  /* 캔버스는 모든 기기에서 360px 표준 황금비율 고정 (다운로드 시 1080px 고해상도 통일) */
  #tiktok-card-canvas {
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
    box-sizing: border-box !important;
  }

  #tiktok-card-canvas.ratio-9-16 {
    height: 640px !important;
    min-height: 640px !important;
    max-height: 640px !important;
    overflow: hidden !important;
  }

  #tiktok-card-canvas.ratio-compact {
    height: max-content !important;
    min-height: unset !important;
    max-height: unset !important;
    overflow: visible !important;
  }

  .tk-canvas-scaler {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
  }

  /* 합배송 키워드 태그 모바일 */
  #safe-keywords .kw-tag {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  /* 관할 세관 테이블 반응형 모바일 (768px 이하) */
  .public-port-table {
    table-layout: fixed !important;
    width: 100% !important;
  }

  .public-port-table .col-port-name {
    width: 29% !important;
    font-size: 11.5px !important;
  }

  .public-port-table .col-port-seized {
    width: 25% !important;
    font-size: 11.5px !important;
  }

  .public-port-table .col-port-status {
    width: 46% !important;
    text-align: right !important;
  }

  .public-port-table col.hide-mob,
  .public-port-table col.hide-tablet {
    width: 0 !important;
    display: none !important;
  }

  .public-port-table th,
  .public-port-table td {
    padding: 7px 4px !important;
  }

  .public-port-table td:last-child {
    text-align: right !important;
  }
}

/* -------------------------------------------------------------
   7. 반응형 미디어 쿼리 (초소형 모바일: 480px 이하)
------------------------------------------------------------- */
@media (max-width: 480px) {

  /* 컨테이너 */
  body.public-page main,
  body.admin-page main,
  body.admin-stats-page main,
  body.public-page .topbar-inner,
  body.admin-page .topbar-inner,
  body.admin-stats-page .topbar-inner {
    width: calc(100% - 16px) !important;
  }

  /* 히어로 및 타이틀 */
  .hero h1 {
    font-size: 19px !important;
  }

  .title-row h1 {
    font-size: 18px !important;
  }

  /* 지표 카드 초소형 */
  .cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  /* 시간대별 차트 초소형 모바일 가로 넘침 방지 */
  body.admin-stats-page .bar-chart {
    gap: 1.5px !important;
  }
  #hour-labels {
    gap: 1.5px !important;
  }
  #hour-labels div {
    font-size: 8.5px !important;
    min-width: 0 !important;
  }
  #hour-labels div:nth-child(even) {
    display: none !important;
  }
  #hour-labels div:nth-child(odd) {
    flex: 2 !important;
  }

  .card {
    padding: 10px 8px !important;
  }

  .card strong {
    font-size: 17px !important;
  }

  /* 상세 테이블 초소형 모바일 */
  body.admin-stats-page .cargo-detail-table .col-hbl,
  .cargo-detail-table .col-hbl {
    width: 44% !important;
  }

  body.admin-stats-page .cargo-detail-table .col-product,
  .cargo-detail-table .col-product {
    width: 32% !important;
    font-size: 10px !important;
  }

  body.admin-stats-page .cargo-detail-table .col-status,
  .cargo-detail-table .col-status {
    width: 24% !important;
    font-size: 10px !important;
  }

  body.admin-stats-page .cargo-detail-table th,
  body.admin-stats-page .cargo-detail-table td,
  .cargo-detail-table th,
  .cargo-detail-table td {
    padding: 5.5px 3px !important;
    font-size: 10px !important;
  }

  .cargo-detail-table td strong {
    font-size: 10.5px !important;
  }

  /* 관할 세관 테이블 초소형 모바일 (480px 이하, iPhone 13 Pro 390px 최적화) */
  .public-port-table .col-port-name {
    width: 28% !important;
    font-size: 10.5px !important;
  }

  .public-port-table .col-port-seized {
    width: 24% !important;
    font-size: 10.5px !important;
  }

  .public-port-table .col-port-status {
    width: 48% !important;
  }

  .public-port-table th,
  .public-port-table td {
    padding: 6px 3px !important;
  }

  .port-status-badge {
    font-size: 10px !important;
    padding: 2.5px 5px !important;
    letter-spacing: -0.2px;
  }

  /* 카드뉴스 프리뷰 초소형 화면 맞춤 스케일러 */
  .tk-canvas-scaler {
    transform: scale(0.96) !important;
    transform-origin: top center !important;
  }

  /* 푸터 링크 */
  footer>div {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
}

@media (max-width: 375px) {
  .tk-canvas-scaler {
    transform: scale(0.90) !important;
    transform-origin: top center !important;
  }
}

@media (max-width: 330px) {
  .tk-canvas-scaler {
    transform: scale(0.80) !important;
    transform-origin: top center !important;
  }
}

/* -------------------------------------------------------------
   8. 반응형 미디어 쿼리 (가로 모드 / 높이 540px 이하 모바일 뷰포트)
------------------------------------------------------------- */
@media (max-height: 540px) {
  body.public-page .topbar,
  body.admin-page .topbar,
  body.admin-stats-page .topbar {
    height: auto !important;
    min-height: 48px !important;
    padding: 6px 0 !important;
  }

  .brand {
    font-size: 13.5px !important;
  }

  .brand small {
    display: none !important;
  }

  .menu-toggle {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }

  .nav-group {
    max-height: 65vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .nav-btn {
    padding: 8px 12px !important;
    min-height: 38px !important;
    font-size: 12.5px !important;
  }

  #tiktok-modal {
    padding: 6px !important;
  }

  #tiktok-modal > div {
    max-height: 98vh !important;
  }
}

/* -------------------------------------------------------------
   9. 반응형 미디어 쿼리 (좁은 창 / 세로 분할 PC 화면: 폭 769px~1100px)
------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 1100px) {
  body.admin-stats-page .cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  body.admin-stats-page .two-col {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .admin-table-toolbar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}


/* ===== 합배송 동반 품목 분류 반응형 그리드 ===== */
.safe-keywords-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kw-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kw-tag-acc {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.kw-tag .kw-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.kw-tag .kw-label {
  flex: 1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kw-tag .kw-count {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .safe-keywords-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .safe-keywords-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .kw-tag {
    padding: 10px 12px;
    font-size: 13px;
  }
}


/* ===== 관리자 상세 추적 테이블 모바일/태블릿 가로 스크롤 (PC 동일 7열 표시) ===== */
.cargo-detail-scroll-wrap {
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ===== 아이폰 품명 신고 키워드 패턴 비교 그리드 (좌우 2열 컴팩트) ===== */
.kw-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .kw-compare-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ===== 관리자 상세 추적 테이블 가로 스크롤 제거 & 100% 고정 폭 레이아웃 ===== */
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table,
.cargo-detail-scroll-wrap .cargo-detail-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  margin: 0 !important;
}

body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table th,
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table td,
.cargo-detail-scroll-wrap .cargo-detail-table th,
.cargo-detail-scroll-wrap .cargo-detail-table td {
  box-sizing: border-box !important;
  padding: 8px 8px !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
  /* PC(데스크탑)에서는 줄바꿈 허용 - 텍스트 잘림 방지 */
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

/* PC 컬럼 비율 (유동 확장 자동 배분) */
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-hbl,
.cargo-detail-scroll-wrap .cargo-detail-table .col-hbl { width: 17% !important; min-width: 0 !important; white-space: nowrap !important; padding-right: 10px !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-product,
.cargo-detail-scroll-wrap .cargo-detail-table .col-product { width: 20% !important; max-width: 250px !important; min-width: 0 !important; padding-left: 6px !important; padding-right: 10px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-forwarder,
.cargo-detail-scroll-wrap .cargo-detail-table .col-forwarder { width: 16% !important; min-width: 0 !important; white-space: nowrap !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-port,
.cargo-detail-scroll-wrap .cargo-detail-table .col-port { width: 5% !important; min-width: 0 !important; text-align: center !important; white-space: nowrap !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-stage,
.cargo-detail-scroll-wrap .cargo-detail-table .col-stage { width: 16% !important; min-width: 0 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-time,
.cargo-detail-scroll-wrap .cargo-detail-table .col-time { width: 12% !important; min-width: 0 !important; white-space: nowrap !important; }
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-status,
.cargo-detail-scroll-wrap .cargo-detail-table .col-status { width: 14% !important; min-width: 0 !important; text-align: center !important; white-space: nowrap !important; }

body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-status .badge,
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-status span,
.cargo-detail-scroll-wrap .cargo-detail-table .col-status .badge,
.cargo-detail-scroll-wrap .cargo-detail-table .col-status span {
  white-space: nowrap !important;
  display: inline-block !important;
}

/* 모바일/태블릿 화면(1024px 이하) 터치 가로 스크롤 및 최소 폭 보장 */
@media (max-width: 1024px) {
  .cargo-detail-scroll-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
  }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table,
  .cargo-detail-scroll-wrap .cargo-detail-table {
    min-width: 820px !important;
    table-layout: auto !important;
  }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-hbl,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-hbl { width: 140px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-product,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-product { width: 220px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-forwarder,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-forwarder { width: 130px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-port,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-port { width: 70px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-stage,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-stage { width: 180px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-time,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-time { width: 140px !important; }
  body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table .col-status,
  .cargo-detail-scroll-wrap .cargo-detail-table .col-status { width: 160px !important; }
}

/* ===== 모바일/태블릿에서도 운송장번호 + 복사버튼 + 택배사 배지 한 줄 유지 (PC 동일) ===== */
body.admin-stats-page .cargo-detail-scroll-wrap .cargo-detail-table td.col-hbl .hbl-cell-wrap,
.cargo-detail-scroll-wrap .cargo-detail-table td.col-hbl .hbl-cell-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
  white-space: nowrap !important;
}
