/* ============================================================
   GS건설 자이(Xi) 브랜드 발주 관리 시스템 - 통합 스타일시트
   Xi Brand Color System:
     Deep Blue    #003087  (60% - 헤더, 주요 버튼, 강조)
     Sky Blue     #0099D6  (10% - 활성, 인터랙션, 포인트)
     Gray         #F2F4F7  (25% - 배경, 구분선, 비활성)
     Heritage Blue #1B4F8A  (5%  - 보조 강조, 차트)
   ============================================================ */

:root {
  /* === Xi 브랜드 컬러 === */
  --xi-deep-blue:     #003087;
  --xi-deep-blue-dk:  #002060;
  --xi-deep-blue-md:  #004299;
  --xi-deep-blue-lt:  #e8edf5;
  --xi-sky-blue:      #0099D6;
  --xi-sky-blue-dk:   #007aad;
  --xi-sky-blue-lt:   #e0f4fc;
  --xi-heritage-blue: #1B4F8A;
  --xi-heritage-lt:   #dde6f0;

  /* === 기능 컬러 === */
  --success:          #1a7a4a;
  --success-lt:       #d4edda;
  --warning:          #c87c00;
  --warning-lt:       #fff3cd;
  --danger:           #c0392b;
  --danger-lt:        #fde8e6;
  --info:             var(--xi-sky-blue);
  --info-lt:          var(--xi-sky-blue-lt);

  /* === 그레이 팔레트 === */
  --white:            #ffffff;
  --gray-50:          #f8f9fa;
  --gray-100:         #F2F4F7;
  --gray-200:         #e4e7ec;
  --gray-300:         #d0d5dd;
  --gray-400:         #98a2b3;
  --gray-500:         #667085;
  --gray-600:         #475467;
  --gray-700:         #344054;
  --gray-800:         #1d2939;
  --gray-900:         #101828;

  /* === 레이아웃 === */
  --sidebar-width:    240px;
  --header-height:    60px;
  --border-radius:    6px;
  --radius-sm:        4px;
  --radius-md:        8px;
  --radius-lg:        12px;

  /* === 그림자 === */
  --shadow-xs:  0 1px 2px rgba(16,24,40,0.05);
  --shadow:     0 1px 3px rgba(16,24,40,0.10), 0 1px 2px rgba(16,24,40,0.06);
  --shadow-md:  0 4px 8px rgba(16,24,40,0.08), 0 2px 4px rgba(16,24,40,0.06);
  --shadow-lg:  0 12px 24px rgba(16,24,40,0.12), 0 4px 8px rgba(16,24,40,0.07);

  /* === 브랜드 별칭 (하위 호환) === */
  --primary:          var(--xi-deep-blue);
  --primary-dark:     var(--xi-deep-blue-dk);
  --primary-light:    var(--xi-deep-blue-lt);
  --secondary:        var(--xi-sky-blue);
}

/* ============================================================
   리셋 & 기본
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--xi-deep-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   로그인 페이지
   ============================================================ */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--xi-deep-blue);
  position: relative;
  overflow: hidden;
}

/* 배경 패턴 (Xi 브랜드 톤) */
#login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 500px at 20% 50%, rgba(0,153,214,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 400px 600px at 80% 20%, rgba(27,79,138,0.2) 0%, transparent 70%);
  pointer-events: none;
}

.login-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-xi-logo {
  height: 36px;
  width: auto;
  display: block;
  margin: 0 auto 16px;
}

.login-logo h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.4;
}

.login-logo p {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.login-divider {
  height: 3px;
  background: var(--xi-deep-blue);
  border-radius: 2px;
  margin: 0 auto 24px;
  width: 40px;
}

/* ============================================================
   앱 레이아웃
   ============================================================ */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   사이드바 (Xi Deep Blue)
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--xi-deep-blue);
  color: var(--white);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

/* 사이드바 헤더 – Xi 로고 영역 */
.sidebar-header {
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-xi-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1); /* 흰색으로 */
}

.sidebar-header-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.25);
}

.sidebar-header-text {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  line-height: 1.4;
  white-space: nowrap;
}

/* 네비게이션 */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: 14px 20px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border-left-color: rgba(0,153,214,0.5);
}

.nav-item.active {
  background: rgba(0,153,214,0.18);
  color: var(--white);
  border-left-color: var(--xi-sky-blue);
  font-weight: 600;
}

.nav-item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active i { opacity: 1; }

/* 사이드바 푸터 */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: rgba(0,153,214,0.3);
  border: 1.5px solid rgba(0,153,214,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.user-detail { flex: 1; min-width: 0; }
.user-detail .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-detail .role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}

/* ============================================================
   메인 콘텐츠 영역
   ============================================================ */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-100);
}

/* 상단 탑바 */
.topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 메인 콘텐츠 */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================================
   폼 요소
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--xi-deep-blue);
  box-shadow: 0 0 0 3px rgba(0,48,135,0.10);
}

.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-text  { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ============================================================
   버튼
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.5;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Primary: Xi Deep Blue */
.btn-primary { background: var(--xi-deep-blue); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--xi-deep-blue-dk); }

/* Secondary: Sky Blue */
.btn-secondary { background: var(--xi-sky-blue); color: var(--white); }
.btn-secondary:hover:not(:disabled) { background: var(--xi-sky-blue-dk); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover:not(:disabled) { background: #155d3a; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover:not(:disabled) { background: #a56800; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-400); }

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--xi-deep-blue);
  color: var(--xi-deep-blue);
}
.btn-outline-primary:hover:not(:disabled) { background: var(--xi-deep-blue-lt); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px 8px; }

/* ============================================================
   카드
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--xi-deep-blue); }

.card-body  { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* ============================================================
   통계 카드 (대시보드 KPI)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--xi-deep-blue);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 색상 변형 */
.stat-card.blue    { border-top-color: var(--xi-deep-blue); }
.stat-card.sky     { border-top-color: var(--xi-sky-blue); }
.stat-card.green   { border-top-color: var(--success); }
.stat-card.orange  { border-top-color: var(--warning); }
.stat-card.red     { border-top-color: var(--danger); }
.stat-card.heritage{ border-top-color: var(--xi-heritage-blue); }
.stat-card.purple  { border-top-color: #6f42c1; }
.stat-card.teal    { border-top-color: #20c997; }

.stat-label {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-sub { font-size: 12px; color: var(--gray-500); }

/* ============================================================
   테이블
   ============================================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: var(--gray-100);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
}

.table tbody tr:hover { background: rgba(0,153,214,0.04); }
.table tbody tr:last-child td { border-bottom: none; }

.table tfoot td {
  border-top: 2px solid var(--gray-200);
  font-weight: 700;
  background: var(--gray-50);
  padding-top: 10px;
}

/* ============================================================
   상태 배지
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* 발주 상태 */
.badge-draft       { background: var(--gray-100); color: var(--gray-600); }
.badge-requested   { background: var(--warning-lt); color: #7d4e00; }
.badge-approved    { background: var(--xi-heritage-lt); color: var(--xi-heritage-blue); }
.badge-rejected    { background: var(--danger-lt); color: #922b21; }
.badge-in_progress { background: var(--xi-sky-blue-lt); color: var(--xi-sky-blue-dk); }
.badge-completed   { background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue); }

/* 프로젝트 상태 */
.badge-active   { background: var(--xi-sky-blue-lt); color: var(--xi-sky-blue-dk); }
.badge-paused   { background: var(--warning-lt); color: #7d4e00; }
.badge-inactive { background: var(--gray-100); color: var(--gray-500); }

/* 역할 배지 */
.badge-gs     { background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue); }
.badge-vendor { background: var(--xi-heritage-lt); color: var(--xi-heritage-blue); }
.badge-admin  { background: rgba(0,48,135,0.08); color: var(--xi-deep-blue); border: 1px solid rgba(0,48,135,0.2); }

/* 프로젝트 배지 */
.badge-project {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--xi-heritage-lt);
  color: var(--xi-heritage-blue);
  border: 1px solid rgba(27,79,138,0.2);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-secondary {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ============================================================
   필터 바
   ============================================================ */
.filter-bar {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group .form-control { font-size: 12px; padding: 6px 10px; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; }

/* ============================================================
   모달
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease;
}

.modal-sm  { max-width: 400px; }
.modal-md  { max-width: 560px; }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1000px; }

.modal-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top: 3px solid var(--xi-deep-blue);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--gray-900); }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.modal-close:hover { color: var(--gray-800); background: var(--gray-100); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   품목 편집 테이블
   ============================================================ */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th {
  background: var(--gray-100);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.items-table td { padding: 7px 6px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.items-table .form-control { padding: 5px 8px; font-size: 12px; }
.items-table td:nth-child(5),
.items-table td:nth-child(6) { font-size: 12px; }

/* ============================================================
   페이지네이션
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 14px;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  transition: all 0.15s;
}

.page-btn:hover { background: var(--xi-deep-blue-lt); border-color: var(--xi-deep-blue); color: var(--xi-deep-blue); }
.page-btn.active { background: var(--xi-deep-blue); color: var(--white); border-color: var(--xi-deep-blue); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   토스트 알림
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  animation: slideIn 0.25s ease;
  cursor: pointer;
  pointer-events: auto;
}

.toast-success { background: var(--success-lt); color: #0d4027; border-left: 3px solid var(--success); }
.toast-error   { background: var(--danger-lt);  color: #7a1c15; border-left: 3px solid var(--danger); }
.toast-info    { background: var(--xi-sky-blue-lt); color: var(--xi-sky-blue-dk); border-left: 3px solid var(--xi-sky-blue); }
.toast-warning { background: var(--warning-lt); color: #7a4e00; border-left: 3px solid var(--warning); }

/* ============================================================
   유틸리티
   ============================================================ */
.hidden          { display: none !important; }
.d-flex          { display: flex; }
.d-grid          { display: grid; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-primary{ color: var(--xi-deep-blue); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-11  { font-size: 11px; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.p-0   { padding: 0; }
.w-100 { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.section-divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}
.empty-state i    { font-size: 44px; margin-bottom: 14px; opacity: 0.3; color: var(--xi-deep-blue); }
.empty-state h3   { font-size: 15px; color: var(--gray-700); margin-bottom: 6px; font-weight: 600; }
.empty-state p    { font-size: 13px; }

/* 로딩 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--gray-500);
  gap: 12px;
  font-size: 13px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--xi-deep-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   발주 상세 정보 그리드
   ============================================================ */
.order-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.info-item  { display: flex; flex-direction: column; gap: 3px; }
.info-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.info-value { font-size: 13px; color: var(--gray-800); font-weight: 500; }

/* 발주 총금액 강조 */
.order-amount-total {
  background: var(--xi-deep-blue-lt);
  border: 1px solid rgba(0,48,135,0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: right;
}

/* ============================================================
   타임라인
   ============================================================ */
.timeline { position: relative; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}
.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--xi-deep-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-content .time { font-size: 11px; color: var(--gray-500); }
.timeline-content .memo { font-size: 13px; color: var(--gray-700); margin-top: 2px; }
.timeline-content .by   { font-size: 12px; font-weight: 600; color: var(--gray-800); }

/* ============================================================
   차트 컨테이너
   ============================================================ */
.chart-container { position: relative; height: 250px; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .order-info-grid { grid-template-columns: 1fr; }
  .filter-bar { gap: 8px; }
}

/* ============================================================
   탭
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  padding: 9px 16px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--xi-deep-blue); }
.tab-btn.active { color: var(--xi-deep-blue); border-bottom-color: var(--xi-deep-blue); }

/* ============================================================
   검색 박스
   ============================================================ */
.search-box { position: relative; }
.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 12px;
}
.search-box .form-control { padding-left: 30px; }

/* ============================================================
   파일 업로드
   ============================================================ */
.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--gray-500);
}
.file-upload-area:hover, .file-upload-area.dragover {
  border-color: var(--xi-deep-blue);
  background: var(--xi-deep-blue-lt);
  color: var(--xi-deep-blue);
}
.file-upload-area i { font-size: 28px; margin-bottom: 8px; display: block; }

/* ============================================================
   숫자 입력 / 스크롤바
   ============================================================ */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   프린트
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0; }
}

/* ============================================================
   알림 배지 / 네비 배지
   ============================================================ */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

.ai-nav-badge {
  margin-left: auto;
  background: var(--xi-sky-blue);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

/* ============================================================
   알림 상태 배지
   ============================================================ */
.badge-sent    { background: var(--success-lt); color: #0d4027; }
.badge-failed  { background: var(--danger-lt);  color: #7a1c15; }
.badge-pending { background: var(--warning-lt); color: #7a4e00; }
.badge-skipped { background: var(--gray-100);   color: var(--gray-500); }

.kakao-color { color: #FEE500; }
.kakao-bg    { background: #FEE500; color: #3A1D1D; }

/* ============================================================
   설정 행 (알림/설정 공통)
   ============================================================ */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 12px;
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 0; }
.setting-info .setting-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.setting-info .setting-desc  { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ============================================================
   토글 스위치
   ============================================================ */
.toggle-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 12px;
  transition: 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--xi-deep-blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 12px; font-weight: 500; color: var(--gray-700); min-width: 28px; }

/* toggle-lg */
.toggle-lg { width: 52px !important; height: 28px !important; }
.toggle-lg .toggle-slider { width: 52px; height: 28px; border-radius: 14px; }
.toggle-lg .toggle-slider::before { width: 22px; height: 22px; top: 3px; left: 3px; }
.toggle-lg input:checked + .toggle-slider::before { transform: translateX(24px); }

/* ============================================================
   알림 로그 아이템
   ============================================================ */
.noti-log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.noti-log-item:last-child { border-bottom: none; }

.noti-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.noti-icon.sent    { background: var(--success-lt); color: var(--success); }
.noti-icon.failed  { background: var(--danger-lt);  color: var(--danger); }
.noti-icon.skipped { background: var(--gray-100);   color: var(--gray-500); }
.noti-icon.pending { background: var(--warning-lt); color: var(--warning); }

.noti-content { flex: 1; min-width: 0; }
.noti-content .noti-type  { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.noti-content .noti-phone { font-size: 12px; color: var(--gray-500); }
.noti-content .noti-time  { font-size: 11px; color: var(--gray-400); }
.noti-content .noti-error { font-size: 11px; color: var(--danger); margin-top: 2px; }

/* 메시지 미리보기 */
.message-preview {
  background: #fffde7;
  border: 1px solid #ffd54f;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--gray-800);
  font-family: inherit;
  max-height: 200px;
  overflow-y: auto;
}

/* 알림 타입 라벨 */
.noti-type-label {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}
.noti-type-label.ORDER_REQUESTED   { background: var(--warning-lt); color: #7a4e00; }
.noti-type-label.ORDER_APPROVED    { background: var(--xi-heritage-lt); color: var(--xi-heritage-blue); }
.noti-type-label.ORDER_REJECTED    { background: var(--danger-lt); color: #922b21; }
.noti-type-label.ORDER_IN_PROGRESS { background: var(--xi-sky-blue-lt); color: var(--xi-sky-blue-dk); }
.noti-type-label.ORDER_COMPLETED   { background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue); }

/* ============================================================
   미니 통계 카드
   ============================================================ */
.mini-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}
.mini-stat-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.mini-stat-val { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.mini-stat-lbl { font-size: 11px; color: var(--gray-500); margin-top: 1px; }

/* 템플릿 에디터 */
.template-editor {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: #1a2035;
  color: #c9d1d9;
  border: 1px solid var(--gray-600);
  resize: vertical;
  min-height: 160px;
}

/* 프로필 섹션 타이틀 */
.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--xi-deep-blue-lt);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item .noti-dot {
  width: 6px; height: 6px;
  background: var(--danger);
  border-radius: 50%;
  margin-left: auto;
}

/* ============================================================
   알림 관리 전용 (ns-* / noti-tab-*)
   ============================================================ */
.noti-page-wrap { display: flex; flex-direction: column; gap: 0; }

.noti-tab-header {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 5px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.noti-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.noti-tab-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.noti-tab-btn.active {
  background: var(--xi-deep-blue);
  color: white;
  box-shadow: var(--shadow-xs);
}
.noti-tab-body { min-height: 200px; }

.ns-stat-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.ns-stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
}
.ns-stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.ns-stat-val { font-size: 20px; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.ns-stat-lbl { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.ns-master-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  border: 2px solid transparent;
  transition: all 0.25s;
}
.ns-master-switch.ns-on  { background: var(--success-lt); border-color: #5cb85c; }
.ns-master-switch.ns-off { background: var(--gray-100); border-color: var(--gray-300); }
.ns-master-left  { display: flex; align-items: center; gap: 12px; }
.ns-master-icon  { display: flex; align-items: center; }
.ns-master-title { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.ns-master-desc  { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

.ns-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.ns-events-header { display: flex; align-items: center; justify-content: space-between; }

.ns-event-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--gray-100);
}
.ns-event-row:last-child { border-bottom: none; }
.ns-event-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.ns-event-info  { flex: 1; min-width: 0; }
.ns-event-label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.ns-event-desc  { font-size: 11px; color: var(--gray-500); margin-top: 1px; }

.ns-event-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.ns-event-card:hover { box-shadow: var(--shadow-md); }
.ns-event-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.ns-event-card-icon  { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.ns-event-card-title { flex: 1; }
.ns-event-card-name  { font-size: 12px; font-weight: 700; color: var(--gray-800); }
.ns-event-card-desc  { font-size: 10px; color: var(--gray-500); }
.ns-event-card-body  { padding: 12px 14px; }

.ns-recipient-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ns-recipient-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.ns-recipient-chip.checked {
  background: var(--xi-deep-blue-lt);
  color: var(--xi-deep-blue);
  border-color: var(--xi-deep-blue);
}
.ns-chip-check { font-size: 10px; }
.ns-rchk { display: none; }

.ns-channel-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ns-channel-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200); background: var(--gray-50);
  font-size: 12px; color: var(--gray-500); transition: all 0.15s;
}
.ns-channel-item.active {
  border-color: var(--xi-deep-blue);
  background: var(--xi-deep-blue-lt);
  color: var(--xi-deep-blue);
}
.ns-channel-icon  { font-size: 13px; }
.ns-channel-name  { font-weight: 600; }
.ns-channel-badge { font-size: 10px; }

.ns-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.ns-legend-section { margin-bottom: 8px; }
.ns-legend-title { font-size: 11px; font-weight: 700; color: var(--gray-500); margin-bottom: 4px; }
.ns-legend-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-600); margin: 2px;
}

.ns-log-filter {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; align-items: center;
}

@media (max-width: 1100px) { .ns-stat-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) {
  .ns-stat-row { grid-template-columns: repeat(2, 1fr); }
  .noti-tab-btn span { display: none; }
  .noti-tab-btn { padding: 8px 12px; }
}

/* ============================================================
   정산 탭 버튼
   ============================================================ */
.stl-tab-header { display: flex; gap: 4px; }
.stl-tab-btn {
  padding: 6px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.15s;
}
.stl-tab-btn.active {
  background: var(--xi-deep-blue);
  border-color: var(--xi-deep-blue);
  color: white;
}
.stl-tab-btn:hover:not(.active) { background: var(--xi-deep-blue-lt); border-color: var(--xi-deep-blue); color: var(--xi-deep-blue); }

/* 정산 KPI 카드 */
.stl-kpi-card {
  flex: 1;
  min-width: 150px;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  color: white;
  box-shadow: var(--shadow);
}

/* 정산 테이블 hover */
#stl-table .table tbody tr:hover {
  background: var(--xi-deep-blue-lt);
  cursor: pointer;
}

/* ============================================================
   상품 관리 추가 스타일
   ============================================================ */
.product-price-cell {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}

#pm-price-section hr {
  border: none;
  border-top: 1px dashed var(--gray-200);
  margin: 12px 0;
}

/* 역할 배너 */
.role-info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* ============================================================
   AI 인사이트 리포트 전용 스타일
   ============================================================ */

/* 페이지 헤더 (Xi Deep Blue 기반) */
.air-page-header {
  background: var(--xi-deep-blue);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.air-page-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.air-page-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: rgba(0,153,214,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.air-page-title    { font-size: 20px; font-weight: 800; color: #fff; margin: 0; }
.air-page-subtitle { font-size: 12px; color: rgba(255,255,255,0.6); margin: 4px 0 0; }
.air-page-badge {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 5px 12px; border-radius: 20px;
  white-space: nowrap;
}
.air-badge-active   { background: rgba(0,153,214,0.2); color: #7de0ff; border: 1px solid rgba(0,153,214,0.4); }
.air-badge-inactive { background: rgba(220,53,69,0.15); color: #ffa0a0; border: 1px solid rgba(220,53,69,0.3); }

/* 빠른 통계 카드 */
.air-qs-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.air-qs-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.15s;
}
.air-qs-card:hover { background: rgba(255,255,255,0.12); }
.air-qs-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(0,153,214,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #7de0ff;
  flex-shrink: 0;
}
.air-qs-num  { font-size: 18px; font-weight: 800; color: #fff; line-height: 1.1; }
.air-qs-desc { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 2px; }

/* 비활성화 배너 */
.air-disabled-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--warning-lt);
  border: 1px solid #ffd54f;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.air-disabled-icon   { font-size: 20px; color: var(--warning); flex-shrink: 0; }
.air-disabled-body   { flex: 1; min-width: 0; }
.air-disabled-title  { font-size: 13px; font-weight: 700; color: #7a4e00; }
.air-disabled-desc   { font-size: 12px; color: #9a6700; margin-top: 2px; }

/* 탭 네비게이션 */
.air-tab-nav {
  display: flex; gap: 3px;
  background: var(--gray-200);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 18px;
  width: fit-content;
}
.air-tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  color: var(--gray-500);
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.air-tab-btn:hover { background: rgba(255,255,255,0.7); color: var(--gray-700); }
.air-tab-btn.active {
  background: #fff;
  color: var(--xi-deep-blue);
  box-shadow: var(--shadow-xs);
}
.air-tab-content { animation: fadeIn 0.15s ease; }

/* 생성 탭 레이아웃 */
.air-gen-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 18px;
  align-items: start;
}
.air-gen-sidebar { position: sticky; top: 20px; }

/* 기간 선택 */
.air-period-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.air-period-pill {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 6px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: #fff; color: var(--gray-600);
  cursor: pointer; transition: all 0.15s;
  font-size: 11px; font-weight: 600;
}
.air-period-pill i { font-size: 14px; }
.air-period-pill:hover { border-color: var(--xi-deep-blue); color: var(--xi-deep-blue); background: var(--xi-deep-blue-lt); }
.air-period-pill.active {
  border-color: var(--xi-deep-blue);
  background: var(--xi-deep-blue-lt);
  color: var(--xi-deep-blue);
  box-shadow: 0 2px 6px rgba(0,48,135,0.12);
}

.air-period-display {
  display: flex; align-items: center; gap: 7px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  margin-top: 10px;
  font-size: 11px; color: var(--gray-600);
}
.air-period-display i { color: var(--xi-deep-blue); }

/* 분석 항목 리스트 */
.air-analysis-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray-100);
}
.air-analysis-item:last-child { border-bottom: none; }
.air-analysis-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}

/* AI 생성 버튼 */
.air-gen-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 12px 18px;
  margin-top: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--xi-deep-blue);
  color: #fff;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 3px 10px rgba(0,48,135,0.25);
}
.air-gen-btn:hover:not(:disabled) {
  background: var(--xi-deep-blue-dk);
  box-shadow: 0 5px 15px rgba(0,48,135,0.3);
}
.air-gen-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.air-gen-result { min-height: 460px; }

/* 플레이스홀더 */
.air-placeholder-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  padding: 56px 36px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  text-align: center;
  min-height: 400px;
}
.air-placeholder-robot {
  position: relative;
  width: 58px; height: 58px;
  background: var(--xi-deep-blue);
  border-radius: 16px;
  margin-bottom: 18px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 12px;
  box-shadow: 0 6px 20px rgba(0,48,135,0.25);
}
.air-robot-eye {
  position: absolute; top: 14px;
  width: 7px; height: 7px;
  background: #fff; border-radius: 50%;
  animation: robotBlink 3s infinite;
}
.air-robot-eye.left  { left: 14px; }
.air-robot-eye.right { right: 14px; }
.air-robot-mouth {
  width: 20px; height: 5px;
  background: rgba(255,255,255,0.55);
  border-radius: 3px;
}
@keyframes robotBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
.air-placeholder-title { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.air-placeholder-desc  { font-size: 12px; color: var(--gray-500); line-height: 1.7; margin-bottom: 18px; }
.air-placeholder-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.air-placeholder-chips span {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 11px; color: var(--gray-600); font-weight: 600;
}

/* 로딩 */
.air-loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 36px; gap: 18px;
  background: var(--gray-50); border-radius: var(--radius-lg);
  min-height: 400px; justify-content: center;
}
.air-loading-orbs { display: flex; gap: 8px; }
.air-orb {
  width: 12px; height: 12px; border-radius: 50%;
  animation: orbFloat 1.1s ease-in-out infinite;
}
.air-orb.o1 { background: var(--xi-deep-blue); animation-delay: 0s; }
.air-orb.o2 { background: var(--xi-sky-blue); animation-delay: 0.2s; }
.air-orb.o3 { background: var(--xi-heritage-blue); animation-delay: 0.4s; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%       { transform: translateY(-9px); opacity: 1; }
}
.air-loading-title { font-size: 15px; font-weight: 600; color: var(--gray-700); }
.air-loading-bar-wrap {
  width: 220px; height: 3px;
  background: var(--gray-200); border-radius: 2px; overflow: hidden;
}
.air-loading-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--xi-deep-blue), var(--xi-sky-blue));
  border-radius: 2px; transition: width 0.4s ease;
}
.air-loading-steps { display: flex; flex-direction: column; gap: 7px; min-width: 210px; }
.air-lstep {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-400);
  transition: all 0.2s;
}
.air-lstep.active { background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue); font-weight: 600; }
.air-lstep.done   { background: var(--success-lt); color: var(--success); }
.air-lstep.done::after { content: ' ✓'; font-weight: 700; }

/* 에러 */
.air-error-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 56px 36px;
  color: var(--danger); font-size: 13px;
  background: var(--danger-lt); border-radius: var(--radius-lg);
  border: 1px solid rgba(192,57,43,0.2);
}
.air-error-wrap i { font-size: 32px; }

/* 리포트 결과 바 */
.air-report-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 8px;
}
.air-report-bar-left  { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.air-report-bar-right { display: flex; gap: 8px; }
.air-report-num       { font-size: 12px; font-weight: 700; color: var(--gray-700); }
.air-report-period-tag, .air-report-time-tag {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--gray-500);
}

/* AI 요약 배너 */
.air-summary-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--xi-deep-blue-lt);
  border: 1px solid rgba(0,48,135,0.15);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.air-summary-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--xi-deep-blue), var(--xi-sky-blue));
}
.air-summary-robot-icon {
  width: 38px; height: 38px;
  background: var(--xi-deep-blue);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}
.air-summary-body  { flex: 1; min-width: 0; }
.air-summary-label {
  font-size: 10px; font-weight: 800;
  color: var(--xi-deep-blue); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 4px;
}
.air-summary-text  { font-size: 13px; color: var(--gray-800); line-height: 1.65; }
.air-summary-badge {
  font-size: 11px; font-weight: 600;
  color: var(--xi-deep-blue); background: rgba(0,48,135,0.1);
  border-radius: var(--radius-sm); padding: 3px 8px;
  white-space: nowrap; align-self: flex-start; flex-shrink: 0;
}

/* KPI 행 */
.air-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.air-kpi-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  transition: box-shadow 0.15s;
}
.air-kpi-item:hover { box-shadow: var(--shadow-md); }
.air-kpi-icon-box {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; margin-bottom: 6px;
}
.air-kpi-num { font-size: 20px; font-weight: 800; color: var(--gray-900); line-height: 1; }
.air-kpi-lbl { font-size: 10px; color: var(--gray-500); margin-top: 3px; }

/* 인사이트 카드 그리드 */
.air-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

/* 인사이트 카드 */
.air-insight-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  border-top: 3px solid var(--card-accent, var(--xi-deep-blue));
  transition: box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 9px;
}
.air-insight-card:hover { box-shadow: var(--shadow-md); }
.air-card-top { display: flex; align-items: flex-start; gap: 9px; }
.air-card-icon-box {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.air-card-heading { flex: 1; min-width: 0; }
.air-card-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  margin-bottom: 3px; letter-spacing: 0.2px;
}
.air-card-title    { font-size: 12px; font-weight: 700; color: var(--gray-800); }
.air-sev-tag {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0; align-self: flex-start;
}
.air-sev-dot2 { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.air-card-headline {
  font-size: 14px; font-weight: 800;
  color: var(--gray-900); line-height: 1.4;
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 9px;
}
.air-card-detail   { font-size: 12px; color: var(--gray-600); line-height: 1.65; }
.air-detail-line   { margin-bottom: 3px; }

/* 카드 메트릭 */
.air-card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}
.air-metric-lbl { font-size: 10px; color: var(--gray-500); margin-bottom: 2px; }
.air-metric-val { font-size: 13px; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 3px; }
.air-delta { font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.air-delta.up { color: var(--success); background: var(--success-lt); }
.air-delta.dn { color: var(--danger); background: var(--danger-lt); }

.air-mini-chart-wrap { border-radius: var(--radius-sm); overflow: hidden; background: var(--gray-50); padding: 5px; }
.air-mini-chart      { max-height: 85px; }

.air-tables-wrap { display: flex; flex-direction: column; gap: 14px; }
.air-detail-card { margin-bottom: 0 !important; }

/* 순위 배지 */
.air-rank-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; white-space: nowrap;
}
.air-rank-badge.rank-1 { background: #fef3c7; color: #b45309; }
.air-rank-badge.rank-2 { background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue); }
.air-rank-badge.rank-3 { background: var(--success-lt); color: var(--success); }

.air-bar-bg   { width: 100%; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.air-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.air-anomaly-badge {
  display: inline-block;
  background: var(--danger-lt); color: var(--danger);
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
}
.air-period-chip {
  display: inline-block;
  background: var(--xi-deep-blue-lt); color: var(--xi-deep-blue);
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 10px;
}

.air-settings-wrap { max-width: 660px; }
.air-llm-card { border: 1px dashed var(--gray-300) !important; background: var(--gray-50) !important; }

/* AI 반응형 */
@media print {
  .sidebar, .topbar, .air-gen-sidebar, .air-tab-nav,
  .air-report-bar .btn, .air-page-header .air-page-badge { display: none !important; }
  .air-gen-layout { grid-template-columns: 1fr !important; }
  .air-gen-result { min-height: auto !important; }
  body { background: #fff; }
}
@media (max-width: 1400px) { .air-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) {
  .air-gen-layout { grid-template-columns: 250px 1fr; }
  .air-cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .air-gen-layout  { grid-template-columns: 1fr; }
  .air-gen-sidebar { position: static; }
  .air-qs-row      { grid-template-columns: repeat(2, 1fr); }
  .air-kpi-row     { grid-template-columns: repeat(3, 1fr); }
  .air-page-title-wrap { flex-direction: column; align-items: flex-start; }
  .air-page-badge  { margin-left: 0; }
}
@media (max-width: 600px) {
  .air-qs-row      { grid-template-columns: 1fr 1fr; }
  .air-kpi-row     { grid-template-columns: repeat(2, 1fr); }
  .air-page-header { padding: 14px; }
  .air-period-grid { grid-template-columns: 1fr 1fr; }
  .air-tab-btn span{ display: none; }
  .air-tab-btn     { padding: 7px 10px; }
}
