/* ==========================================================================
   news_scrap — design system
   토큰(변수) 기반. 색상만 바꾸면 브랜드 전체가 바뀌도록 구성.
   ========================================================================== */

:root {
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;

  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-hover: #fafaf8;
  --ink: #191b1f;
  --ink-soft: #43474e;
  --muted: #767b85;
  --border: #e5e5e0;
  --border-strong: #d4d4cd;

  --accent: #2653c4;
  --accent-strong: #1d43a3;
  --accent-soft: #edf1fc;

  --success: #1c7c3d;
  --success-soft: #e8f5ec;
  --danger: #b3261e;
  --danger-soft: #fdedec;
  --warn: #92600a;
  --warn-soft: #fdf3e0;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.05);
  --shadow-md: 0 2px 8px rgba(20, 22, 26, 0.07);
  --shadow-lg: 0 8px 28px rgba(20, 22, 26, 0.1);
}

/* 다크 토큰. OS가 다크이고 사용자가 라이트를 강제하지 않은 경우(자동),
   또는 사용자가 다크를 직접 선택한 경우(data-theme="dark") 동일하게 적용된다. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --surface: #181b21;
    --surface-hover: #1e222a;
    --ink: #e9eaed;
    --ink-soft: #c3c6cd;
    --muted: #8b909a;
    --border: #2a2e37;
    --border-strong: #3a3f4a;

    --accent: #7d9bf5;
    --accent-strong: #9cb3f8;
    --accent-soft: #1f2637;

    --success: #6fce8f;
    --success-soft: #16281c;
    --danger: #f2857e;
    --danger-soft: #331b19;
    --warn: #e5b567;
    --warn-soft: #2e2413;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #101216;
  --surface: #181b21;
  --surface-hover: #1e222a;
  --ink: #e9eaed;
  --ink-soft: #c3c6cd;
  --muted: #8b909a;
  --border: #2a2e37;
  --border-strong: #3a3f4a;

  --accent: #7d9bf5;
  --accent-strong: #9cb3f8;
  --accent-soft: #1f2637;

  --success: #6fce8f;
  --success-soft: #16281c;
  --danger: #f2857e;
  --danger-soft: #331b19;
  --warn: #e5b567;
  --warn-soft: #2e2413;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

h1,
h2,
h3 {
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   layout
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

main.container {
  flex: 1;
  padding-top: 36px;
  padding-bottom: 64px;
}

/* --------------------------------------------------------------------------
   header / nav
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 13px;
  color: var(--muted);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   toast (화면 우하단 고정 알림)
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
  pointer-events: none;
  transition: bottom 0.2s ease;
}

/* 맨 위로 버튼이 떠 있을 땐 토스트를 그 위로 올려 겹치지 않게 한다 */
body.scrolled .toast-container {
  bottom: 84px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast::before {
  flex-shrink: 0;
  font-weight: 800;
}

.toast-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.toast-success::before {
  content: "✓";
}

.toast-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.toast-error::before {
  content: "!";
}

/* 수집 진행 중 토스트 — 작업이 끝날 때까지 남아 있는다(자동 소멸 없음) */
.toast-busy {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  cursor: default;
}

.toast-busy::before {
  content: "";
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 640px) {
  .toast-container {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }

  body.scrolled .toast-container {
    bottom: 74px;
  }
}

/* --------------------------------------------------------------------------
   scroll-to-top 버튼
   -------------------------------------------------------------------------- */

.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease,
    background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body.scrolled .scroll-top {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   page head
   -------------------------------------------------------------------------- */

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
}

.page-head .page-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* 설정 관리 상단 도구 모음 (전체 가져오기 · 새 설정 등록) */
.sources-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.sources-toolbar .btn svg {
  vertical-align: -2px;
  margin-right: 4px;
}

/* 수집 진행 상태 칸 (설정 관리 표) */
.job-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* 상태(첫 줄) + 수치(둘째 줄).
   알약 배지 안에 두 줄을 넣으면 점·여백이 어색해서 색으로만 상태를 구분한다. */
.job-progress {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.3;
}

.job-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.job-progress-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;  /* 숫자가 바뀌어도 폭이 흔들리지 않게 */
}

.job-progress.is-running .job-progress-label,
.job-progress.is-queued .job-progress-label {
  color: var(--accent);
}

.job-progress.is-done .job-progress-label {
  color: var(--success);
}

.job-progress.is-failed .job-progress-label {
  color: var(--warn);
}

/* 취소 아이콘 버튼은 표의 동작 버튼(32px)보다 작게 — 상태 옆 보조 동작이다.
   .btn-icon 기본 크기를 덮어야 해서 .job-state를 앞에 붙여 우선순위를 높인다. */
.job-state .btn-cancel-job {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.job-state .btn-cancel-job svg {
  width: 14px;
  height: 14px;
}

.job-state .btn-cancel-job:disabled {
  opacity: 0.5;
  cursor: default;
}

/* 가져오기 범위 토글 (설정 등록·수정 폼)
   .field label / .field input 의 기본 폼 스타일을 덮어야 하므로
   .field 를 앞에 붙여 우선순위를 높인다. */
.field .scope-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 0;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.field .scope-toggle:hover {
  border-color: var(--accent);
}

/* 켜졌을 때는 색만 바꾼다 — 크기·굵기를 건드리면 아래 요소가 밀린다 */
.field:has(.scope-toggle input:checked) .scope-toggle {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

/* 체크박스를 스위치 트랙으로 바꾼다 */
.field .scope-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.18s ease;
}

/* 스위치 손잡이 */
.field .scope-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}

.field .scope-toggle input[type="checkbox"]:checked {
  background: var(--accent);
}

.field .scope-toggle input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.field .scope-toggle input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .field .scope-toggle,
  .field .scope-toggle input[type="checkbox"],
  .field .scope-toggle input[type="checkbox"]::after {
    transition: none;
  }
}

/* 카드 제목 + 닫기 버튼 한 줄 배치 */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-head .card-title {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-soft);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

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

.btn-sm {
  padding: 5px 11px;
  font-size: 13px;
}

/* 테두리 없는 보조 버튼 (예: 필터 초기화) — 주 버튼 옆에서 무게를 낮춘다 */
.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

/* 정사각형 아이콘 버튼 */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-icon-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

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

.btn-icon:disabled:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-soft);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* 수집 진행 중인 버튼: 아이콘 대신 스피너 + "수집 중…" 라벨 (비활성이어도 흐려지지 않는다) */
.btn-icon.is-busy {
  width: auto;
  gap: 7px;
  padding: 0 11px;
  border-color: var(--accent);
  color: var(--accent);
  cursor: progress;
}

.btn-icon.is-busy:disabled,
.btn-icon.is-busy:disabled:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
  cursor: progress;
}

.btn-icon.is-busy > svg {
  display: none;
}

.btn-icon.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-busy-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* 수집 중에는 링크형 동작(수정 등)도 잠근다 — 버튼은 disabled로 처리 */
a.is-locked {
  pointer-events: none;
  opacity: 0.4;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .toast-busy::before,
  .btn-icon.is-busy::before {
    animation-duration: 2.4s;
  }
}

.btn:disabled:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-soft);
}

.btn-primary:disabled:hover {
  background: var(--accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-muted {
  background: var(--surface-hover);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   keyword chips
   -------------------------------------------------------------------------- */

.kw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kw-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.kw-chip::before {
  content: "#";
  margin-right: 1px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 24px;
}

.card + .card,
.card + .table-wrap,
.table-wrap + .card {
  margin-top: 24px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   forms
   -------------------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field .hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.form-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   tables
   -------------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

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

td .cell-actions form {
  margin: 0;
}

.cell-url {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-title {
  font-weight: 600;
  max-width: 350px;
}

/* 기사 관리 2줄째의 키워드 칸 — 칩이 여러 개여도 셀 안에서 줄바꿈된다 */
.cell-keywords {
  max-width: 320px;
  white-space: normal;
}

.cell-keywords .kw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* 접혀 있을 때 나머지 키워드는 감춘다.
   [hidden] 속성은 .kw-chip의 display:inline-flex에 밀리므로 클래스로 처리한다. */
.cell-keywords:not(.is-expanded) .kw-extra {
  display: none;
}

/* "외 N개" / "접기" 토글 — 칩과 같은 모양이되 눌리는 것임을 색으로 구분 */
.kw-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.kw-more:hover {
  border-color: var(--accent);
}

.kw-more:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.kw-empty {
  color: var(--muted);
}

/* 기사 관리: 기사 하나 = 두 줄 (1줄 제목+컨트롤, 2줄 메타) */
.article-item .article-title-row td {
  padding-bottom: 2px;
  border-bottom: none;
  max-width: none;
  white-space: normal;
}

.title-row-flex {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  justify-content: space-between;
}

.title-main {
  min-width: 0;
  flex: 1;
}

.title-main .title-text {
  font-size: 15px;
  font-weight: 700;
}

.article-item .article-title-row .badge {
  margin-right: 6px;
  vertical-align: middle;
}

.article-item .article-title-row .kw-chips {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
}

.article-actions-inline {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.article-actions-inline form {
  margin: 0;
}

.article-item .article-data-row td {
  padding-top: 4px;
  border-bottom: 1px solid var(--border);
}

.article-item:last-child .article-data-row td {
  border-bottom: none;
}

.article-item:hover td {
  background: var(--surface-hover);
}

code.selector {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   filter tabs / list toolbar
   -------------------------------------------------------------------------- */

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.list-toolbar .tabs {
  margin-bottom: 0;
}

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

.bulk-actions form {
  margin: 0;
}

/* 선택 일괄 작업 — 체크한 기사에만 적용된다 */
.select-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.select-all input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.select-count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 화면 밖 기사까지 잡힌 상태 — 건수가 커질 수 있어 눈에 띄게 한다 */
.select-count.is-all {
  color: var(--accent);
  font-weight: 700;
}

/* 선택된 기사가 없으면 작업 버튼은 눌리지 않는다 */
.select-actions button[data-bulk]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 기사 행의 선택 체크박스 */
.row-check {
  display: flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
}

.row-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.article-item.is-selected td {
  background: var(--accent-soft);
}

/* 필터 패널 — 목록을 좁히는 컨트롤을 한 덩어리로 묶어 표(카드)와 구분한다 */
.filter-panel {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* 검색이 남는 폭을 차지하고 나머지는 내용 폭 — 화면이 좁아지면 자동으로 접힌다 */
.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, auto)) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;  /* 그리드 안에서 select가 칸을 밀고 나가지 않게 */
}

.filter-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.filter-field select,
.filter-field input {
  width: 100%;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  height: 38px;  /* 버튼과 높이를 맞춰 한 줄로 정렬되게 */
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.filter-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.filter-actions .btn {
  height: 38px;
}

/* 결과 건수 + 일괄 작업. 위험한 일괄 작업은 구분선 아래 오른쪽 끝으로 떼어 둔다 */
.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
  border-radius: 0 0 var(--radius) var(--radius);
}

.filter-summary .result-count {
  margin: 0;
}

.filter-panel .stats-gap-note {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 안내문이 있으면 그 위 요약줄의 아래 모서리는 펴진다 */
.filter-summary:not(:last-child) {
  border-radius: 0;
}

@media (max-width: 900px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-search,
  .filter-actions {
    grid-column: 1 / -1;
  }
  /* 좁은 화면에서는 주 버튼만 남는 폭을 채운다(초기화까지 늘리면 무게가 같아 보인다) */
  .filter-actions .btn-primary {
    flex: 1;
  }
}

.result-count {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.result-count strong {
  color: var(--ink);
}

/* 통계 집계 건수와 목록 건수가 어긋날 때의 안내 (폐기·삭제분은 목록에 없음) */
.stats-gap-note {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.stats-gap-note strong {
  color: var(--ink);
}

/* 활성 필터 칩 (예: 통계에서 넘어온 키워드) */
.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 6px 3px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.active-filter strong {
  color: inherit;
}

.active-filter-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

.active-filter-clear:hover {
  background: var(--accent);
  color: #fff;
}

/* 무한 스크롤 */
#scroll-sentinel {
  height: 1px;
}

.load-indicator {
  padding: 18px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* 뉴스 상단 줄 — 확인 상태 탭(왼쪽) + 카테고리·검색(오른쪽) */
.news-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 접지 않고 한 줄을 유지한다 — 모자라면 아래 .news-filter가 줄어든다.
     wrap이면 검색창이 줄어들기 전에 필터 전체가 다음 줄로 내려간다. */
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 20px;
}

/* 탭은 그대로 두고 필터 쪽만 줄인다 */
.news-toolbar .tabs {
  flex-shrink: 0;
}

/* 툴바 안에서는 탭의 아래 여백을 툴바가 대신한다 */
.news-toolbar .tabs {
  margin-bottom: 0;
}

.news-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  /* 줄바꿈 대신 검색창이 줄어들게 한다 — 태블릿 폭에서 툴바가 두 줄로 접히던 원인 */
  flex-wrap: nowrap;
  min-width: 0;
}

.news-filter select,
.news-filter input[type="search"] {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* 남는 폭을 검색창이 흡수한다. 좁아지면 200px보다 줄어들되 최소한은 유지 */
.news-filter input[type="search"] {
  flex: 1 1 200px;
  min-width: 96px;
}

.news-filter select,
.news-filter .btn {
  flex: none;
}

.news-filter select:focus,
.news-filter input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* 키워드 다중 선택 드롭다운 */
.kw-picker {
  position: relative;
}

.kw-picker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kw-picker-toggle:hover,
.kw-picker-toggle[aria-expanded="true"] {
  border-color: var(--accent);
}

.kw-picker-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* 키워드를 여러 개 고르면 라벨이 길어져 툴바를 밀어낸다 — 폭을 묶고 말줄임 처리 */
.kw-picker-label {
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 아무것도 안 고른 상태는 자리표시자처럼 흐리게 */
.kw-picker-label.is-empty {
  color: var(--muted);
}

.kw-picker-caret {
  font-size: 10px;
  color: var(--muted);
}

.kw-picker-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  max-width: calc(100vw - 40px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.kw-picker-list {
  max-height: 280px;
  overflow-y: auto;
}

.kw-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.kw-picker-item:hover {
  background: var(--surface-hover);
}

.kw-picker-item input {
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.kw-picker-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kw-picker-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.kw-picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.kw-picker-empty {
  margin: 0;
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* 어떤 조건으로 걸러진 목록인지 알려주는 한 줄 */
.news-filter-note {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.news-filter-note strong {
  color: var(--ink);
}

/* 이보다 좁으면 한 줄에 다 넣기를 포기하고 필터를 아래로 내린다
   (검색창이 최소 폭까지 줄어들어도 안 들어가는 지점) */
@media (max-width: 720px) {
  .news-toolbar {
    flex-wrap: wrap;
  }

  .news-filter {
    width: 100%;
    flex-wrap: wrap;
  }

  .news-filter input[type="search"] {
    flex: 1 1 140px;
    min-width: 0;
  }
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.tabs a,
.tabs button {
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  /* 좌우 여백을 줄여 툴바 전체 폭을 아낀다(뉴스 화면에서 필터와 한 줄에 들어가야 함) */
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.tabs a:hover,
.tabs button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.tabs a.active,
.tabs button.active {
  background: var(--accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   news list (사용자 뷰)
   -------------------------------------------------------------------------- */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.news-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.news-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.news-category {
  margin-bottom: 8px;
}

.news-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.news-card .kw-chips {
  margin: 0 0 12px;
}

.news-card:hover h2 {
  color: var(--accent);
}

.news-card .news-summary {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.news-meta .sep {
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   news detail (기사 본문)
   -------------------------------------------------------------------------- */

.article-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 40px 44px;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 24px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.article-back:hover {
  color: var(--accent);
}

.article-category {
  margin-bottom: 12px;
}

.article-page h1 {
  margin: 0 0 14px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.article-keywords {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.article-keywords-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.news-content {
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-soft);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.news-content p {
  margin: 0 0 1.1em;
}

/* 수집 본문 안의 이미지·캡션 */
.news-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 22px auto 8px;
  border-radius: var(--radius-sm);
}

.news-content img + em,
.news-content figcaption {
  display: block;
  margin: 0 0 22px;
  text-align: center;
  font-size: 13px;
  font-style: normal;
  color: var(--muted);
}

/* 기사 첫머리 요약 등 블록 강조 */
.news-content > strong {
  display: block;
  margin: 0 0 20px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
}

/* 문단 안 강조 */
.news-content p strong,
.news-content p b {
  color: var(--ink);
}

.news-content blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.article-actions {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   empty state
   -------------------------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}

.empty .empty-icon {
  font-size: 34px;
  margin-bottom: 10px;
}

.empty p {
  margin: 0;
  font-size: 14.5px;
}

.empty .empty-sub {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.8;
}

td.empty {
  padding: 40px 16px;
}

/* --------------------------------------------------------------------------
   responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .site-header .container {
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  main.container {
    padding-top: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .article-page {
    padding: 26px 20px;
  }

  .article-page h1 {
    font-size: 22px;
  }

  .news-card {
    padding: 18px;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   theme toggle (header)
   -------------------------------------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 라이트일 때 달, 다크일 때 해 — 클릭하면 바뀔 테마를 아이콘으로 안내 */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* --------------------------------------------------------------------------
   news list — 확인(read) 상태
   -------------------------------------------------------------------------- */

.tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.news-item {
  position: relative;
}

.news-item.is-read .news-card {
  opacity: 0.62;
}

.news-item.is-read .news-card h2 {
  color: var(--muted);
}

/* 카드 제목이 우측 상단 체크 아이콘 밑으로 들어가지 않도록 여백 확보 */
.news-card h2 {
  padding-right: 40px;
}

/* 확인 체크 아이콘 — 카드(아이템) 우측 상단 고정 */
.read-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.read-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 확인 완료(체크됨): 강조색으로 채움 */
.read-toggle[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 본문 첫 이미지 썸네일이 있는 카드는 이미지(좌) + 본문(우) 가로 배치 */
.news-card.has-thumb {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.news-card-main {
  flex: 1 1 auto;
  min-width: 0; /* 자식 텍스트 말줄임/줄바꿈이 정상 동작하도록 */
}

.news-card-thumb {
  flex: 0 0 auto;
  width: 72px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-hover);
}

.news-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .news-card-thumb {
    width: 60px;
  }
}

/* --------------------------------------------------------------------------
   keyword statistics
   -------------------------------------------------------------------------- */

.stats-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 18px;
}

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

.stats-card {
  padding: 20px 22px;
}

.stats-card-title {
  margin: 0 0 14px;
  font-size: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stats-card-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.kw-rank {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kw-rank-row {
  display: grid;
  grid-template-columns: 22px minmax(72px, auto) 1fr 40px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.kw-rank-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.kw-rank-name {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 클릭하면 기사 관리에서 해당 키워드로 필터링된다 */
.kw-rank-link {
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.kw-rank-link:hover,
.kw-rank-link:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.kw-rank-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}

.kw-rank-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.kw-rank-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
}

/* --------------------------------------------------------------------------
   admin mode (login icon / logout)
   -------------------------------------------------------------------------- */

.admin-icon-form {
  margin: 0;
  display: inline-flex;
}

.admin-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   admin login page
   -------------------------------------------------------------------------- */

.auth-page {
  max-width: 420px;
  margin: 40px auto;
}

.auth-card {
  padding: 34px 30px;
  text-align: center;
}

.auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.auth-form {
  margin-top: 22px;
  text-align: left;
}

.auth-form label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.auth-form .btn {
  width: 100%;
  margin-top: 16px;
  justify-content: center;
}

.auth-back {
  display: inline-block;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.auth-back:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   설정 테스트 결과 패널
   -------------------------------------------------------------------------- */

.form-actions-right {
  display: flex;
  gap: 8px;
}

.source-test-result {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

.source-test-result.is-error {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
}

.test-status {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.test-block + .test-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.test-h {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
}

.test-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.test-line {
  margin: 0 0 8px;
  font-size: 14px;
}

.test-line.ok {
  color: var(--success);
}

.test-line.bad {
  color: var(--danger);
}

.test-line strong {
  color: var(--ink);
}

.test-samples {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.test-samples li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.test-sample-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.test-sample-url {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0 0 10px;
}

.test-meta div {
  display: flex;
  gap: 6px;
  font-size: 13px;
}

.test-meta dt {
  color: var(--muted);
}

.test-meta dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

.test-preview {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.test-image {
  display: block;
  max-width: 200px;
  max-height: 140px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* --- HTML 붙여넣기 모달 (SPA 수동 가져오기) --- */
.html-modal {
  width: min(720px, 92vw);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.html-modal::backdrop {
  background: rgba(20, 22, 26, 0.45);
}

.html-modal-body {
  padding: 22px;
}

.html-modal-body .card-title {
  margin: 0 0 6px;
}

.html-modal-body textarea {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
}

.html-modal-body textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.html-modal-body .form-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
