/* ── 전역 변수 & 리셋 ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #1c2128;
  --bg-hover:     #21262d;
  --border:       #30363d;
  --border-light: #21262d;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  --accent:        #1DB954;   /* 네이버 그린 */
  --accent-dim:    rgba(29, 185, 84, 0.15);
  --accent-hover:  #1ed760;

  --blue:   #58a6ff;
  --purple: #bc8cff;
  --orange: #ffa657;
  --red:    #f85149;
  --yellow: #e3b341;

  --sidebar-w: 220px;
  --header-h:  68px;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg-base:      #f6f8fa;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f8f9fa;
  --bg-hover:     #f0f3f6;
  --border:       #e1e4e8;
  --border-light: #ebedf0;

  --text-primary:   #1F2328;
  --text-secondary: #57606a;
  --text-muted:     #8c959f;

  --shadow:    0 4px 12px rgba(0,0,0,0.06);
}

html { font-size: 14px; }

.hidden { display: none !important; }

/* ── CRM 상단 유저 드롭다운 ───────────────────────────────────────────── */
.user-profile-dropdown {
  position: relative;
  display: inline-block;
}

.user-profile-btn {
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
}
.user-profile-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1000;
  min-width: 100%;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s cubic-bezier(0, 0, 0.2, 1);
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-item {
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  transition: background var(--transition);
}
.user-dropdown-item:hover {
  background: var(--bg-hover);
}
.user-dropdown-item.danger {
  color: var(--red);
}
.user-dropdown-item.danger:hover {
  background: rgba(248, 81, 73, 0.12);
}

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── 스크롤바 ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── 스크롤 탑 버튼 ─────────────────────────────────────────────────────── */
.scroll-to-top {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background-color 0.2s, border-color 0.2s;
  box-shadow: var(--shadow);
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 사이드바 ────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #000;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition);
}
.status-dot.online  { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.offline { background: var(--red); }

.status-text { font-size: 11.5px; color: var(--text-secondary); }

/* ── 메인 콘텐츠 ─────────────────────────────────────────────────────── */
.main-content {
  margin-left: 0;
  flex: 1;
  padding: 16px 28px 40px;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ── 상단 헤더 ───────────────────────────────────────────────────────── */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border-bottom: 1px solid var(--border-light);
  padding: 0 0 16px 0;
  margin-bottom: 28px;
  position: relative;
  background: transparent;
  z-index: 1;
}

.header-left h1 {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin: 0;
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.period-selector {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 38px;
}

.period-btn {
  padding: 0 14px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.period-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.period-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  box-sizing: border-box;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
.icon-btn.spinning svg { animation: spin 1s linear infinite; }

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── 섹션 ────────────────────────────────────────────────────────────── */
.section { animation: fadeIn 0.25s ease; }
.section.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── KPI 카드 ────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), transform var(--transition);
 padding: 12px 16px; }

.kpi-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.cost-icon   { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.clicks-icon { background: rgba(29, 185, 84, 0.15);  color: var(--accent); }
.imps-icon   { background: rgba(188, 140, 255, 0.15); color: var(--purple); }
.ctr-icon    { background: rgba(255, 166, 87, 0.15);  color: var(--orange); }

.kpi-info { display: flex; flex-direction: column; gap: 3px; }
.kpi-label { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; line-height: 1.1; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); }

/* ── 차트 ────────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
 padding: 12px 16px; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chart-badge {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 600;
}

.chart-wrap { position: relative; height: 220px; }
.donut-wrap { height: 220px; display: flex; align-items: center; justify-content: center; }
.donut-wrap canvas { max-height: 210px !important; }

/* ── 테이블 섹션 ─────────────────────────────────────────────────────── */
.section-toolbar {
  margin-bottom: 16px;
}

.select-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  transition: border-color var(--transition);
}
.select-box:focus { outline: none; border-color: var(--accent); }
.select-box option { background: var(--bg-elevated); color: var(--text-primary); }

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.table-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.table-count { font-size: 12px; color: var(--text-secondary); }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-elevated);
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
  line-height: 1.4;
}

.data-table tr:hover td { background: var(--bg-hover); }

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
  font-size: 13px;
}

/* ── 버튼 ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all var(--transition);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--accent); }

.btn-sm {
  background: var(--bg-hover);
  color: var(--blue);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-sm:hover { background: rgba(88, 166, 255, 0.15); border-color: var(--blue); }

/* ── 토글 스위치 ─────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── 잔액 섹션 ───────────────────────────────────────────────────────── */
.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.billing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.billing-card.main-balance {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, var(--bg-surface), rgba(29,185,84,0.05));
}

.billing-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.billing-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 6px;
}

.billing-sub { font-size: 12px; color: var(--text-secondary); }

.budget-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.budget-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
}
.budget-input:focus { outline: none; border-color: var(--accent); }

.progress-wrap { margin-top: 8px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #00e676);
  transition: width 0.8s ease;
}

.progress-bar-fill.warning { background: linear-gradient(90deg, var(--orange), var(--red)); }
.progress-info { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* ── 상태 뱃지 ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 42px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  box-sizing: border-box;
}
.badge-on      { background: var(--accent-dim); color: var(--accent); }
.badge-off     { background: rgba(248,81,73,0.15); color: var(--red); }
.badge-paused  { background: rgba(227,179,65,0.15); color: var(--yellow); }

/* ── 입찰가 인라인 편집 ──────────────────────────────────────────────── */
.bid-input {
  width: 80px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  text-align: right;
}
.bid-input:focus { outline: none; border-color: var(--accent); }

/* ── 토스트 ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 999;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--red); }

/* ── 로딩 스켈레톤 ───────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

/* ── 반응형 ──────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); }
  .kpi-grid { grid-template-columns: 1fr; }
  .billing-grid { grid-template-columns: 1fr; }
  .main-content { padding: 0 16px 40px; }
}

/* ── 페이지네이션 ─────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 16px;
}

.page-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.page-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 10px;
}

/* ── 플로팅 액션 바 (Bulk Action) ────────────────────────────────────── */
.floating-action-bar {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 16px 24px;
  border-radius: 50px;
  z-index: 1000;
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 20px;
}
.floating-action-bar.show {
  bottom: 40px;
}
.fab-content {
  display: flex;
  align-items: center;
  gap: 20px;
}
.fab-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.fab-actions {
  display: flex;
  gap: 10px;
}

/* ── 탭 버튼 ─────────────────────────────────────────────────────────── */
.ab-tabs-wrapper {
  margin-top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ab-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 3px;
  height: 38px;
  box-sizing: border-box;
  vertical-align: middle;
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0 14px;
  height: 30px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  border: 1px solid var(--border-light);
}

/* Master Switch Toggle */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border); transition: .2s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(16px); }

/* ── 모달 & 오버레이 ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}
.modal-backdrop.hidden {
  display: none !important;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close-btn:hover { color: var(--text-primary); }
.modal-body {
  padding: 24px;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 태그 뱃지 ────────────────────────────────────────────────────────── */
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  margin-right: 6px;
  letter-spacing: -0.2px;
  vertical-align: middle;
}
.badge-powerlink {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.3);
}
.badge-powercontent {
  background: rgba(188, 140, 255, 0.18);
  color: #bc8cff;
  border: 1px solid rgba(188, 140, 255, 0.35);
}


