/* =========================================================
   AIHelp 뉴스 관리자 — Modern Design System
   ========================================================= */

:root {
  --primary:        #6366f1;
  --primary-50:     #eef2ff;
  --primary-100:    #e0e7ff;
  --primary-200:    #c7d2fe;
  --primary-500:    #6366f1;
  --primary-600:    #4f46e5;
  --primary-700:    #4338ca;

  --success:        #10b981;
  --success-50:     #ecfdf5;
  --warning:        #f59e0b;
  --warning-50:     #fffbeb;
  --danger:         #ef4444;
  --danger-50:      #fef2f2;
  --info:           #06b6d4;
  --info-50:        #ecfeff;

  --gray-50:        #f9fafb;
  --gray-100:       #f3f4f6;
  --gray-200:       #e5e7eb;
  --gray-300:       #d1d5db;
  --gray-400:       #9ca3af;
  --gray-500:       #6b7280;
  --gray-600:       #4b5563;
  --gray-700:       #374151;
  --gray-800:       #1f2937;
  --gray-900:       #111827;

  --body-bg:        #f5f6fa;
  --card-bg:        #ffffff;
  --border-color:   #e5e7eb;
  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;

  --sidebar-width:  248px;
  --sidebar-collapsed-width: 72px;
  --topbar-height:  64px;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 2px rgba(17, 24, 39, .05);
  --shadow:         0 1px 3px rgba(17, 24, 39, .07), 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-md:      0 4px 6px -1px rgba(17, 24, 39, .07), 0 2px 4px -2px rgba(17, 24, 39, .04);
  --shadow-lg:      0 10px 15px -3px rgba(17, 24, 39, .08), 0 4px 6px -4px rgba(17, 24, 39, .04);

  --bs-primary:     var(--primary);
  --bs-primary-rgb: 99, 102, 241;
  --bs-body-color:  var(--text-primary);
  --bs-body-bg:     var(--body-bg);
  --bs-border-color: var(--border-color);
  --bs-border-radius: var(--radius);
  --bs-link-color: var(--primary-600);
  --bs-link-hover-color: var(--primary-700);
}

/* ── Base ───────────────────────────────────────────── */
html, body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}

* { box-sizing: border-box; }

a { text-decoration: none; }

/* ── App shell ─────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.app-sidebar {
  grid-area: sidebar;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .2s;
}
.app-sidebar:hover {
  scrollbar-color: var(--gray-200) transparent;
}
/* Webkit (Chrome/Safari) 얇은 스크롤바 */
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; transition: background .2s; }
.app-sidebar:hover::-webkit-scrollbar-thumb { background: var(--gray-200); }
.app-sidebar:hover::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }
.app-topbar {
  grid-area: topbar;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}
.app-main {
  grid-area: main;
  padding: 24px 28px 60px;
  min-width: 0;
}

@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .app-sidebar {
    position: fixed;
    left: -100%;
    transition: left .25s ease;
    width: 280px;
  }
  .app-shell.sidebar-open .app-sidebar {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .35);
    z-index: 45;
  }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .app-main {
    padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 60px);
  }
  .page-header { margin-bottom: 14px; }
  .page-header h1 { font-size: 18px; }
  .topbar-inner { padding: 0 12px; gap: 10px; }
  .topbar-actions { gap: 6px; }
  .topbar-icon-btn { width: 34px; height: 34px; }
  .topbar-user { padding: 3px 6px 3px 3px; }
  .topbar-user .avatar { width: 26px; height: 26px; font-size: 11px; }

  /* Tables → card view on mobile */
  .table-responsive-cards { display: block; }
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tbody,
  .table-responsive-cards tr { display: block; width: 100%; }
  .table-responsive-cards tr {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    position: relative;
  }
  .table-card .table-responsive-cards { padding: 12px; background: var(--body-bg); }
  .table-card { background: transparent; border: 0; box-shadow: none; }
  .table-responsive-cards tbody tr:last-child { margin-bottom: 0; }
  .table-responsive-cards tbody tr:hover { background: #fff; }
  .table-responsive-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-100);
    text-align: right;
    min-height: 28px;
    font-size: 13.5px;
  }
  .table-responsive-cards td:last-child { border-bottom: 0; }
  .table-responsive-cards td[data-label]::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    text-align: left;
  }
  .table-responsive-cards td.cell-actions {
    border-bottom: 0;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--gray-100);
    justify-content: flex-end;
  }
  .table-responsive-cards td.cell-actions::before { display: none; }
  .table-responsive-cards .row-actions { justify-content: flex-end; gap: 6px; }
  .table-responsive-cards .btn-icon.btn-sm { width: 34px; height: 34px; }
  .table-responsive-cards .empty-state { padding: 36px 16px; }

  /* 헤드 셀: 라벨 숨기고 제목+배지를 풀 폭으로 좌측 정렬 */
  .table-responsive-cards td.cell-primary {
    display: block;
    text-align: left;
    padding: 4px 0 10px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 6px;
    font-size: 14.5px;
  }
  .table-responsive-cards td.cell-primary::before { display: none; }
  .table-responsive-cards td.cell-primary .fw-medium { font-size: 14.5px; line-height: 1.4; }
  .table-responsive-cards td.cell-primary > div:first-child {
    flex-wrap: wrap; align-items: center; gap: 6px;
  }

  /* 배지/플래그 셀: 우측 정렬되 배지가 자연스럽게 wrap */
  .table-responsive-cards td[data-label="플래그"] { justify-content: space-between; }
  .table-responsive-cards td[data-label="플래그"] .flag-toggles {
    background: transparent; padding: 0; gap: 6px;
  }
  .table-responsive-cards td[data-label="플래그"] .flag-toggle {
    width: 36px; height: 36px;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
  }

  /* Filter bars stack vertically on mobile */
  .filter-bar { padding: 10px; gap: 6px; }
  .filter-bar .form-control,
  .filter-bar .form-select { min-width: 0; flex: 1 1 140px; font-size: 14px; }

  /* Card body padding gentler */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* Modal full-width on phones */
  .modal-dialog { margin: 8px; }
  .modal-body { padding: 16px; }
  .modal-header,
  .modal-footer { padding: 12px 16px; }

  /* Form controls bigger to prevent iOS zoom on focus */
  .form-control, .form-select { font-size: 16px; padding: 10px 12px; }
  .form-control-sm, .form-select-sm { font-size: 14px; }
}

@media (max-width: 480px) {
  .app-main { padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 56px); }
  .page-header { gap: 10px; }
  .page-header h1 { font-size: 17px; }
  .page-header .btn { padding: 8px 12px; font-size: 13px; }
  .stat-card { padding: 14px 14px; gap: 12px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-value { font-size: 19px; }
  .table-responsive-cards td { font-size: 13px; }
  .topbar-icon-btn[title="사이트 보기"] { display: none; }
}

/* ── Sidebar brand (행간 / Between the Lines) ──────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand .brand-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1;
  width: 130px;
  flex-shrink: 1;
  min-width: 0;
}
.sidebar-brand .brand-line {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--gray-900);
  flex-shrink: 0;
}
.sidebar-brand .brand-ko {
  font-family: 'Nanum Myeongjo', 'Noto Serif KR', serif;
  font-weight: 700;
  font-size: 22px;
  color: #ff6a13;
  letter-spacing: .12em;
  margin: 4px 0 3px;
  line-height: 1;
}
.sidebar-brand .brand-en {
  font-family: 'EB Garamond', 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 11px;
  color: var(--gray-700);
  margin-top: 3px;
  letter-spacing: .02em;
}
.sidebar-brand .brand-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.app-shell.sidebar-collapsed .sidebar-brand .brand-en,
.app-shell.sidebar-collapsed .sidebar-brand .brand-tag { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0 6px; }
.app-shell.sidebar-collapsed .sidebar-brand .brand-stack { width: 48px; }
.app-shell.sidebar-collapsed .sidebar-brand .brand-line { height: 1.5px; }
.app-shell.sidebar-collapsed .sidebar-brand .brand-ko {
  font-size: 19px;
  margin: 6px 0;
  letter-spacing: .08em;
}

.sidebar-nav {
  padding: 6px 10px 10px;
}
.sidebar-section-title {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 1px;
  transition: background-color .12s, color .12s;
}
.sidebar-link:hover {
  background: var(--gray-50);
  color: var(--gray-900);
}
.sidebar-link.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}
.sidebar-link.active svg { color: var(--primary-600); }
.sidebar-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--gray-500);
}
.sidebar-link.active svg { color: var(--primary-600); }
.sidebar-link .badge {
  margin-left: auto;
  font-size: 10px;
}

/* ── Collapsed sidebar (desktop hamburger) — 아이콘만 ── */
.app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); overflow: visible; }
.app-shell.sidebar-collapsed .sidebar-nav { padding: 12px 8px; }
.app-shell.sidebar-collapsed .sidebar-section-title {
  font-size: 0;
  padding: 8px 4px 4px;
  height: 1px;
  overflow: hidden;
  border-top: 1px solid var(--border-color);
  margin: 4px 4px 6px;
  text-indent: -9999px;
}
.app-shell.sidebar-collapsed .sidebar-section-title:first-child { border-top: 0; margin-top: 0; }
.app-shell.sidebar-collapsed .sidebar-link {
  position: relative;
  justify-content: center;
  padding: 11px 0;
  gap: 0;
  margin-bottom: 4px;
}
.app-shell.sidebar-collapsed .sidebar-link > span,
.app-shell.sidebar-collapsed .sidebar-link .badge { display: none; }
.app-shell.sidebar-collapsed .sidebar-link svg { width: 20px; height: 20px; }

/* Hover 시 라벨 풍선 (같은 요소 ::after) */
.app-shell.sidebar-collapsed .sidebar-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-900);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 60;
  box-shadow: var(--shadow-md);
}
.app-shell.sidebar-collapsed .sidebar-link:hover::after { opacity: 1; }
.app-shell.sidebar-collapsed .sidebar-link:not([data-label])::after { content: none; }

/* ── Topbar ───────────────────────────────────────── */
.topbar-inner {
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--gray-600);
  cursor: pointer;
}
.topbar-toggle:hover { background: var(--gray-50); }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--gray-600);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--gray-50); color: var(--gray-900); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.topbar-user:hover { background: var(--gray-50); }
.topbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}
.topbar-user .avatar.avatar-img { background: var(--gray-100); }
.topbar-user .avatar.avatar-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.topbar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}
.topbar-user .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Page header ───────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
  letter-spacing: -.02em;
}
.page-header .breadcrumb {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.page-header .breadcrumb a { color: var(--text-muted); }
.page-header .breadcrumb a:hover { color: var(--gray-700); }
.page-header .breadcrumb .sep { color: var(--gray-300); }

/* ── Card ─────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card-header {
  padding: 16px 20px;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2,
.card-header h3,
.card-header .card-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
  color: var(--gray-900);
}
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 14px 20px;
  background: transparent;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── KPI / Stat card ─────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.bg-primary  { background: var(--primary-50); color: var(--primary-600); }
.stat-icon.bg-success  { background: var(--success-50); color: var(--success); }
.stat-icon.bg-warning  { background: var(--warning-50); color: var(--warning); }
.stat-icon.bg-danger   { background: var(--danger-50); color: var(--danger); }
.stat-icon.bg-info     { background: var(--info-50); color: var(--info); }
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all .12s;
  white-space: nowrap;
}
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .2); }
.btn svg { width: 15px; height: 15px; }

.btn-sm  { font-size: 12.5px; padding: 6px 10px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-xs  { font-size: 11.5px; padding: 4px 8px; }
.btn-xs svg { width: 12px; height: 12px; }
.btn-lg  { font-size: 15px; padding: 11px 18px; }

.btn-primary {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }

.btn-secondary {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-800);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-900); }

.btn-light {
  background: #fff;
  border-color: var(--border-color);
  color: var(--gray-800);
}
.btn-light:hover { background: var(--gray-50); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-dark    { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.btn-dark:hover { background: var(--gray-700); color: #fff; }

.btn-outline-primary { background: #fff; color: var(--primary-600); border-color: var(--primary-200); }
.btn-outline-primary:hover { background: var(--primary-50); color: var(--primary-700); }
.btn-outline-secondary { background: #fff; color: var(--gray-700); border-color: var(--border-color); }
.btn-outline-secondary:hover { background: var(--gray-50); color: var(--gray-900); }
.btn-outline-success { background: #fff; color: var(--success); border-color: #d1fae5; }
.btn-outline-success:hover { background: var(--success-50); }
.btn-outline-warning { background: #fff; color: var(--warning); border-color: #fde68a; }
.btn-outline-warning:hover { background: var(--warning-50); }
.btn-outline-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-outline-danger:hover { background: var(--danger-50); }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-grid; place-items: center;
}
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn-icon.btn-xs { width: 24px; height: 24px; }
.btn-link { background: transparent; border-color: transparent; color: var(--primary-600); padding: 4px; }
.btn-link:hover { color: var(--primary-700); background: var(--primary-50); border-radius: var(--radius-sm); }

/* ── Forms ────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--gray-900);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.form-control:disabled,
.form-select:disabled {
  background: var(--gray-50);
  color: var(--text-muted);
}
.form-control-sm,
.form-select-sm { padding: 6px 10px; font-size: 12.5px; }

textarea.form-control { min-height: 80px; }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group > .form-control,
.input-group > .form-select { flex: 1 1 auto; min-width: 0; }
.input-group-text {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  color: var(--gray-600);
  font-size: 13px;
}
.input-group > :first-child:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :last-child:not(:first-child)  { border-top-left-radius:  0; border-bottom-left-radius:  0; border-left: 0; }
.input-group > :not(:first-child):not(:last-child) { border-radius: 0; border-left: 0; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
  min-height: auto;
}
.form-check-input {
  width: 16px; height: 16px;
  margin: 0;
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--primary-600);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.form-check-label { cursor: pointer; font-size: 13.5px; }

/* ── Tables ───────────────────────────────────────── */
.table {
  width: 100%;
  margin-bottom: 0;
  vertical-align: middle;
  border-collapse: collapse;
  font-size: 13.5px;
  color: var(--gray-800);
}
.table thead th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--gray-50); }

.table .row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table-card { overflow: hidden; }
.table-card .table { margin: 0; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1.4;
  letter-spacing: 0;
}
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-success { background: var(--success-50); color: #047857; }
.badge-warning { background: var(--warning-50); color: #b45309; }
.badge-danger  { background: var(--danger-50); color: #b91c1c; }
.badge-info    { background: var(--info-50); color: #0e7490; }
.badge-secondary { background: var(--gray-100); color: var(--gray-700); }
.badge-light  { background: var(--gray-50); color: var(--gray-700); border: 1px solid var(--border-color); }
.badge-dark   { background: var(--gray-800); color: #fff; }

/* Bootstrap compat */
.bg-primary    { background-color: var(--primary-600) !important; color: #fff; }
.bg-success    { background-color: var(--success) !important; color: #fff; }
.bg-warning    { background-color: var(--warning) !important; color: #fff; }
.bg-danger     { background-color: var(--danger) !important; color: #fff; }
.bg-info       { background-color: var(--info) !important; color: #fff; }
.bg-dark       { background-color: var(--gray-900) !important; color: #fff; }
.bg-secondary  { background-color: var(--gray-500) !important; color: #fff; }
.bg-light      { background-color: var(--gray-100) !important; color: var(--gray-800); }

.text-primary  { color: var(--primary-600) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-info     { color: var(--info) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-dark     { color: var(--gray-900) !important; }
.text-secondary { color: var(--gray-500) !important; }

.fw-medium     { font-weight: 500; }
.fw-semibold   { font-weight: 600; }
.fw-bold       { font-weight: 700; }

/* ── Alerts ───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert .btn-close { margin-left: auto; }
.alert-success { background: var(--success-50); color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: var(--danger-50);  color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-50); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--info-50);    color: #155e75; border-color: #a5f3fc; }

/* ── Pagination ───────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0;
  list-style: none;
  margin: 0;
}
.pagination .page-item .page-link {
  display: grid; place-items: center;
  min-width: 32px; height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.pagination .page-item .page-link:hover { background: var(--gray-50); }
.pagination .page-item.active .page-link {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
}
.pagination .page-item.disabled .page-link {
  opacity: .5;
  pointer-events: none;
}

/* ── Modals (Bootstrap base + custom polish) ────── */
.modal-content {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body  { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

/* ── List group ───────────────────────────────────── */
.list-group { border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; }
.list-group-flush { border: 0; border-radius: 0; }
.list-group-item {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
}
.list-group-item:last-child { border-bottom: 0; }

/* ── Misc ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px; height: 48px;
  color: var(--gray-300);
  margin-bottom: 12px;
}
.empty-state-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}
.empty-state-desc { font-size: 13px; color: var(--text-muted); }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.media-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s;
  display: flex; flex-direction: column;
}
.media-card:hover { box-shadow: var(--shadow-md); }
.media-thumb {
  aspect-ratio: 1;
  background: var(--gray-100);
  cursor: pointer;
  overflow: hidden;
}
.media-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .2s;
}
.media-thumb:hover img { transform: scale(1.05); }
.media-meta {
  padding: 10px 12px;
  font-size: 12px;
}
.media-meta .name { font-weight: 500; color: var(--gray-800); }
.media-meta .size { color: var(--text-muted); margin-top: 2px; }
.media-actions {
  padding: 8px 10px;
  border-top: 1px solid var(--border-color);
  display: flex; gap: 4px;
}

.kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  background: var(--gray-100);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.font-mono { font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace; font-size: .92em; }

.divider { height: 1px; background: var(--border-color); margin: 12px 0; }

.dropdown-menu {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  font-size: 13.5px;
}
.dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
  color: var(--gray-700);
}
.dropdown-item:hover { background: var(--gray-50); color: var(--gray-900); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--gray-500); }

/* ── Auth pages ──────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -10px rgba(99, 102, 241, .25), 0 8px 16px -4px rgba(17, 24, 39, .08);
  padding: 36px 32px;
}
.auth-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1;
  width: 160px;
  margin: 0 auto 20px;
  text-align: center;
  background: transparent;
  border-radius: 0;
}
.auth-brand .brand-line { display: block; width: 100%; height: 1.5px; background: var(--gray-900); }
.auth-brand .brand-ko {
  font-family: 'Nanum Myeongjo','Noto Serif KR',serif;
  font-weight: 700; font-size: 26px;
  color: #ff6a13;
  letter-spacing: .12em;
  margin: 6px 0;
}
.auth-brand .brand-en {
  font-family: 'EB Garamond','Cormorant Garamond',serif;
  font-style: italic; font-weight: 500;
  font-size: 13px; color: var(--gray-700);
  margin-top: 2px; letter-spacing: .02em;
}
.auth-title { font-size: 20px; font-weight: 700; text-align: center; margin: 0 0 4px; color: var(--gray-900); }
.auth-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.auth-tag {
  display: inline-block; margin: -10px auto 18px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: .18em;
  color: var(--primary-700); background: var(--primary-50);
  border: 1px solid var(--primary-100); padding: 3px 9px; border-radius: 4px;
}

/* ── Toast (custom) ──────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1080;
  display: flex; flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast-item {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  animation: toast-in .2s ease-out;
}
.toast-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.success svg { color: var(--success); }
.toast-item.danger  { border-left: 3px solid var(--danger); }
.toast-item.danger  svg { color: var(--danger); }
.toast-item.info    { border-left: 3px solid var(--info); }
.toast-item.info    svg { color: var(--info); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Utility helpers ─────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.flex-1 { flex: 1 1 0%; }

.thumb-sm  { width: 40px;  height: 40px;  object-fit: cover; border-radius: var(--radius-sm); }
.thumb-md  { width: 56px;  height: 56px;  object-fit: cover; border-radius: var(--radius-sm); }
.thumb-lg  { width: 80px;  height: 80px;  object-fit: cover; border-radius: var(--radius-sm); }

.spinner-border {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress bar ────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  background: var(--primary-500);
  height: 100%;
  transition: width .3s;
}

/* ── Filter bar ───────────────────────────────────── */
.filter-bar {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar .form-control,
.filter-bar .form-select { min-width: 140px; }

/* ── Tabs / pills (status filter) ────────────────── */
.btn-group-pill {
  display: inline-flex;
  background: var(--gray-100);
  padding: 3px;
  border-radius: var(--radius);
  gap: 0;
}
.btn-group-pill .btn {
  border: 0;
  background: transparent;
  color: var(--gray-600);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: calc(var(--radius) - 3px);
}
.btn-group-pill .btn.active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}
.btn-group-pill .btn:hover:not(.active) { color: var(--gray-800); }

/* ── Article-edit Thumbnail card ─────────────────── */
.thumbnail-card .card-body { padding: 16px; }
.thumb-preview {
  position: relative;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 200px;
  display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.thumb-preview[data-has-image="1"] {
  border-style: solid;
  border-color: var(--border-color);
  background:
    linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
    linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.thumb-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
}
.thumb-placeholder {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
}
.thumb-placeholder .thumb-placeholder-title {
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-700);
}
.thumb-placeholder .thumb-placeholder-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.55;
}
.thumb-clear {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .12s, transform .08s;
}
.thumb-clear:hover { background: var(--danger); }
.thumb-clear:active { transform: scale(.92); }
.thumb-clear svg { width: 16px; height: 16px; }

/* ── Article inline flag badges (속보·특집·영상) ──── */
.art-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 4px;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.art-badge-breaking { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.art-badge-breaking svg { color: #dc2626; fill: currentColor; }
.art-badge-featured { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.art-badge-featured svg { color: #d97706; fill: currentColor; }
.art-badge-video    { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.art-badge-video    svg { color: #7c3aed; fill: currentColor; }

/* Flag toggle column buttons */
.flag-toggles {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--gray-50);
  border-radius: 8px;
  padding: 2px;
}
.flag-toggle {
  appearance: none;
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: 6px;
  display: inline-grid; place-items: center;
  cursor: pointer;
  color: var(--gray-300);
  transition: background .12s, color .12s, transform .08s;
}
.flag-toggle svg { width: 15px; height: 15px; stroke-width: 2; }
.flag-toggle:hover { background: #fff; color: var(--gray-500); }
.flag-toggle.is-on { background: #fff; box-shadow: var(--shadow-sm); }
.flag-toggle.is-on.flag-breaking { color: #dc2626; }
.flag-toggle.is-on.flag-breaking svg { fill: #dc2626; }
.flag-toggle.is-on.flag-featured { color: #d97706; }
.flag-toggle.is-on.flag-featured svg { fill: #d97706; }
.flag-toggle.is-on.flag-video    { color: #7c3aed; }
.flag-toggle.is-on.flag-video    svg { fill: #7c3aed; }
.flag-toggle:active { transform: scale(.92); }

@media (max-width: 991.98px) {
  .flag-toggles { background: transparent; padding: 0; gap: 4px; }
  .flag-toggle { width: 32px; height: 32px; background: var(--gray-50); }
}

/* ── Article status tab pills ────────────────────── */
.article-status-tabs {
  display: flex;
  gap: 4px;
  align-items: stretch;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.article-status-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.article-status-tab svg { width: 15px; height: 15px; color: var(--gray-500); }
.article-status-tab .cnt {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--gray-100);
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}
.article-status-tab:hover { background: var(--gray-50); color: var(--gray-900); }
.article-status-tab.is-active {
  background: var(--primary-50);
  color: var(--primary-700);
}
.article-status-tab.is-active svg { color: var(--primary-600); }
.article-status-tab.is-active .cnt { background: var(--primary-100); color: var(--primary-700); }
.article-status-tab.is-archive.is-active {
  background: #fef3c7;
  color: #92400e;
}
.article-status-tab.is-archive.is-active svg { color: #b45309; }
.article-status-tab.is-archive.is-active .cnt { background: #fde68a; color: #92400e; }
@media (max-width: 575.98px) {
  .article-status-tab { padding: 6px 10px; font-size: 12px; }
  .article-status-tab .cnt { font-size: 10px; padding: 1px 6px; }
}

/* ── Global overflow guards ──────────────────────── */
html, body { overflow-x: hidden; }
.app-main {
  min-width: 0;
  overflow-x: hidden;
}
.card, .table-card {
  max-width: 100%;
  overflow: hidden;
}
.card .card-body, .card .card-header, .card .card-footer {
  min-width: 0;
}
.card.table-card > .table:not(.table-responsive-cards) {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card.table-card > .table:not(.table-responsive-cards) thead,
.card.table-card > .table:not(.table-responsive-cards) tbody {
  display: table;
  width: 100%;
  table-layout: auto;
}
@media (max-width: 991.98px) {
  .card.table-card > .table:not(.table-responsive-cards) {
    min-width: 720px;
  }
  .card.table-card.has-scroll {
    overflow-x: auto;
  }
}
img, video, iframe { max-width: 100%; }
pre, code { white-space: pre-wrap; word-break: break-word; }

/* card-footer 페이지네이션 row */
.card-footer .pagination { margin: 0; }
.card-footer { gap: 12px; flex-wrap: wrap; }

/* ── Print ───────────────────────────────────────── */
@media print {
  .app-sidebar, .app-topbar, .btn { display: none !important; }
  .app-main { padding: 0; }
}
