:root {
  --primary: #1e3a8a;
  --primary-color: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #172554;
  --accent: #0ea5e9;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
}

/* Header */
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  gap: 1.5rem;
}

/* 관리자 전용 와이드 네비게이션 & 컨테이너 (모니터 해상도 100% 활용) */
.nav-container.admin-nav,
.admin-container {
  max-width: 98% !important;
  width: 98% !important;
}

.admin-container {
  margin: 0.6rem auto 0.4rem auto;
  padding: 0 0.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary);
  flex-shrink: 0;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 6px 12px;
  font-weight: 800;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  white-space: nowrap;
}

.nav-menu a {
  text-decoration: none;
  color: #334155;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-menu a:hover {
  color: var(--primary-light);
  background-color: #f1f5f9;
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav-dropdown-toggle::after {
  content: " ▾";
  font-size: 0.75rem;
  color: #64748b;
}

.nav-dropdown:hover .nav-dropdown-toggle {
  color: var(--primary-light);
  background-color: #f1f5f9;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  min-width: 170px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0;
  z-index: 1200;
  list-style: none;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li {
  width: 100%;
}

.nav-dropdown-menu li a {
  display: block;
  padding: 0.6rem 1.2rem;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
}

.nav-dropdown-menu li a:hover {
  background-color: #f8fafc;
  color: var(--primary-light);
  font-weight: 600;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Hero Section (슬림 컴팩트 배너 - 높이 50% 압축) */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #0284c7 100%);
  color: white;
  padding: 1.25rem 1.8rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgb(30 58 138 / 0.15);
}

.hero-text h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.3px;
}

.hero-text p {
  font-size: 0.88rem;
  opacity: 0.92;
  max-width: 680px;
  line-height: 1.5;
}

/* Logged-in User Welcome Bar (초슬림 웰컴 바 - 높이 50px) */
.welcome-bar {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

.welcome-bar-text {
  font-size: 0.92rem;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.welcome-bar-text b {
  color: #1e3a8a;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary-light);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: #334155;
}

.btn-outline:hover {
  background-color: #f1f5f9;
}

.btn-success { background-color: var(--success); color: white; }
.btn-danger { background-color: var(--danger); color: white; }
.btn-warning { background-color: var(--warning); color: white; }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-returned { background: #e2e8f0; color: #475569; }

/* Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-compact th,
.table-compact td {
  padding: 0.55rem 0.85rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* 엑셀식 2차원 틀 고정 (상단 헤더 + 좌측 3대 컬럼 고정) 및 동적 뷰포트 높이 래퍼 */
.table-freeze-wrap {
  height: calc(100vh - 230px);
  min-height: 350px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.table-freeze-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-freeze-wrap::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.table-freeze-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-freeze-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-freeze {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100%;
}

/* 상단 헤더 틀 고정 */
.table-freeze thead th {
  position: sticky;
  top: 0;
  background-color: #f1f5f9 !important;
  z-index: 10;
  border-bottom: 2px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 좌측 1열 (ID) 틀 고정 */
.table-freeze .col-freeze-1 {
  position: sticky;
  left: 0;
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 1px solid var(--border);
}

/* 좌측 2열 (무선국 종별) 틀 고정 */
.table-freeze .col-freeze-2 {
  position: sticky;
  left: 55px;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 1px solid var(--border);
}

/* 좌측 3열 (채널구간/명칭) 틀 고정 및 우측 입체 경계선 그림자 */
.table-freeze .col-freeze-3 {
  position: sticky;
  left: 195px;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 4px 0 6px -2px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 교차점: 헤더이면서 좌측 틀 고정인 th 셀 (가장 높은 z-index 부여) */
.table-freeze thead th.col-freeze-1,
.table-freeze thead th.col-freeze-2,
.table-freeze thead th.col-freeze-3 {
  background-color: #e2e8f0 !important;
  z-index: 25 !important;
}

/* 행 hover 시 좌측 틀 고정 셀도 동일한 배경색 적용 */
.table-freeze tr:hover td.col-freeze-1,
.table-freeze tr:hover td.col-freeze-2,
.table-freeze tr:hover td.col-freeze-3 {
  background-color: #f8fafc !important;
}

/* 통계 및 요약 카드가 상단에 있는 화면 전용 동적 높이 래퍼 */
.table-freeze-wrap-stats {
  height: calc(100vh - 350px);
  min-height: 280px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}
.table-freeze-wrap-stats::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-freeze-wrap-stats::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.table-freeze-wrap-stats::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-freeze-wrap-stats::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 주파수 신청승인 화면(freq_req_list) 전용 좌측 1~3열 틀 고정 (신청번호, 상태, 심사/상세) */
.table-freeze .col-req-freeze-1 {
  position: sticky;
  left: 0;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 1px solid var(--border);
  text-align: left;
  padding: 0.6rem 0.65rem !important;
}

.table-freeze .col-req-freeze-2 {
  position: sticky;
  left: 160px;
  width: 85px;
  min-width: 85px;
  max-width: 85px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 1px solid var(--border);
  text-align: center;
}

.table-freeze .col-req-freeze-3 {
  position: sticky;
  left: 245px;
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  background-color: #ffffff;
  z-index: 5;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 4px 0 6px -2px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.table-freeze thead th.col-req-freeze-1,
.table-freeze thead th.col-req-freeze-2,
.table-freeze thead th.col-req-freeze-3 {
  background-color: #e2e8f0 !important;
  z-index: 25 !important;
}

.table-freeze tr:hover td.col-req-freeze-1,
.table-freeze tr:hover td.col-req-freeze-2,
.table-freeze tr:hover td.col-req-freeze-3 {
  background-color: #f8fafc !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.85rem;
}

td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}

/* 엑셀식 슬림 콤팩트 테이블 (표준 11pt(13px) 폰트 & 34px 슬림 행 높이) */
.table-compact th,
.admin-container th {
  padding: 0.38rem 0.6rem !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  background-color: #f1f5f9;
}

.table-compact td,
.admin-container td {
  padding: 0.32rem 0.6rem !important;
  font-size: 0.82rem !important; /* 엑셀 11pt 환산 13px */
  line-height: 1.25 !important;
  height: 34px;
}

/* 관리자 화면 타이틀 및 부제목 슬림 규격 통일 */
.admin-container h2 {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #1e293b !important;
  margin-bottom: 0.15rem !important;
}

.admin-container p.subtitle,
.admin-container h2 + p {
  color: #64748b !important;
  font-size: 0.78rem !important;
  margin-top: 2px !important;
}

tr:hover td {
  background-color: #f8fafc;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.alert-success { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Grid Dashboard */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.25rem 0;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

/* =========================================================================
   🖥️ PC 환경 및 뷰 모드 전환 버튼 정밀 제어 (헌법 0-12조)
   ========================================================================= */
#navBtnToggleView {
  display: none !important; /* 기본 상태(순수 데스크톱 PC 및 모바일 기본 모드)에서는 영구 숨김 */
}
