/* [2026-11-05] 관리자 화면 가독성 1단계 — 화면층만 (기능·번들 무변경)
   왜: 글꼴 미지정(system-ui), 한글이 낱말 중간에서 꺾임(휴대폰 상단·표 머리글),
       흐린 회색·밝은 파랑/빨강 글씨 대비 미달, 휴대폰 통계·표 가로 넘침.
   되돌리기: index.html 의 readability.css 링크 한 줄만 지우면 원상복구.
   원칙: 밝은 화면은 :where() 로 특이도를 낮춰 hover:·dark: 색이 그대로 이기게 하고,
         어두운 화면은 원래 CSS 가 !important 라서 같은 특이도 + 뒤 순서로만 덮는다. */

/* 1. 글꼴 — Pretendard (라틴·숫자도 같은 글꼴), 표 숫자는 폭 고정 */
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[style*="SF Pro Display"] { font-family: "Pretendard Variable", Pretendard, -apple-system, system-ui, sans-serif !important; }
td, th { font-variant-numeric: tabular-nums; }

/* 2. 한글은 낱말 단위로만 줄바꿈 (넘칠 만큼 긴 낱말만 예외) */
body { word-break: keep-all; overflow-wrap: break-word; }
th { white-space: nowrap; }
header button, header span { white-space: nowrap; }

/* 3. 밝은 화면 글자 대비 (흰 바탕 4.5:1 이상) */
:where(html:not(.dark)) .text-gray-400 { color: #5b6472; }
:where(html:not(.dark)) .text-gray-500 { color: #5b6472; }
:where(html:not(.dark)) .text-blue-400,
:where(html:not(.dark)) .text-blue-500 { color: #2563eb; }
:where(html:not(.dark)) .text-red-400,
:where(html:not(.dark)) .text-red-500 { color: #dc2626; }
:where(html:not(.dark)) .text-red-600 { color: #b91c1c; }
:where(html:not(.dark)) .text-indigo-500 { color: #4f46e5; }
:where(html:not(.dark)) .text-amber-600 { color: #b45309; }
:where(html:not(.dark)) .text-green-600 { color: #15803d; }
:where(html:not(.dark)) .text-yellow-600 { color: #a16207; }

/* 4. 어두운 화면 글자 대비 (#1f2937·#111827 바탕) */
html.dark .text-gray-400,
html.dark .dark\:text-gray-400:is(.dark *) { color: #9ca3af !important; }
/* 옅은 색 바탕(bg-*-100 알약)은 어두운 화면에서도 밝은 바탕이라 제외 */
:where(.dark) .text-blue-500:not([class*="bg-"]) { color: #60a5fa; }
.dark .hover\:text-indigo-600:hover { color: #a5b4fc; }
:where(.dark) .text-green-600:not([class*="bg-"]) { color: #4ade80; }
:where(.dark) .text-yellow-600:not([class*="bg-"]) { color: #facc15; }
/* 선택칸(react-select) 안 보이지 않는 입력칸에 원래 CSS 의 .dark input 회색 바탕이 칠해져
   선택된 값의 첫 글자를 가리던 것 */
.dark .react-select__input-container input { background-color: transparent !important; border: 0 !important; }
:where(.dark) .text-red-500:not([class*="bg-"]),
:where(.dark) .text-red-600:not([class*="bg-"]) { color: #f87171; }
:where(.dark) .text-indigo-500:not([class*="bg-"]),
:where(.dark) .text-indigo-600:not([class*="bg-"]),
:where(.dark) .text-indigo-700:not([class*="bg-"]) { color: #a5b4fc; }
:where(.dark) .text-purple-600:not([class*="bg-"]),
:where(.dark) .text-purple-700:not([class*="bg-"]) { color: #c4b5fd; }

/* 연한 색 바탕(엠바고 줄=노랑, 실패 줄=분홍 등)이 어두운 화면에서도 밝게 남아
   밝은 글씨가 안 보이던 것 → 같은 색 계열의 어두운 바탕으로. dark:bg-* 가 붙은 곳은 그대로 이김 */
:where(.dark) .bg-red-50 { background-color: #3b1d22; }
:where(.dark) .bg-yellow-50 { background-color: #36310f; }
:where(.dark) .bg-amber-50 { background-color: #3a2e12; }
:where(.dark) .bg-orange-50 { background-color: #3b2412; }
:where(.dark) .bg-blue-50 { background-color: #172a46; }
:where(.dark) .bg-green-50 { background-color: #14301f; }
:where(.dark) .bg-indigo-50 { background-color: #1e2148; }
:where(.dark) .bg-purple-50 { background-color: #2c1d45; }

/* 위 어두운 바탕 안의 진한 글씨(-700~900)는 같은 계열 밝은 색으로 */
:where(.dark) :is(.bg-red-50,.bg-yellow-50,.bg-amber-50,.bg-orange-50,.bg-blue-50,.bg-green-50,.bg-indigo-50,.bg-purple-50) { color: #e5e7eb; }
:where(.dark) :is(.text-blue-700,.text-blue-800,.text-blue-900):not([class*="bg-"]) { color: #93c5fd; }
:where(.dark) :is(.text-red-700,.text-red-800,.text-red-900):not([class*="bg-"]) { color: #fca5a5; }
:where(.dark) :is(.text-green-700,.text-green-800,.text-green-900):not([class*="bg-"]) { color: #86efac; }
:where(.dark) :is(.text-yellow-700,.text-yellow-800,.text-amber-700,.text-amber-800,.text-orange-700,.text-orange-800):not([class*="bg-"]) { color: #fcd34d; }
:where(.dark) :is(.text-indigo-800,.text-indigo-900,.text-purple-800,.text-purple-900):not([class*="bg-"]) { color: #c4b5fd; }

/* 결제일 알림 창: 어두운 화면에서 연분홍·연노랑 바탕 위 밝은 글씨라 이름이 안 보이던 것 */
html.dark .bg-red-50.mb-2 { background-color: #3b1d22 !important; }
html.dark .bg-amber-50.mb-2 { background-color: #3a2e12 !important; }
:where(.dark) .bg-amber-50.mb-2 .text-amber-600 { color: #fbbf24; }

/* 5. 흰 글씨 버튼 바탕 (두 화면 공통) */
:where(html) .text-white.bg-red-500 { background-color: #dc2626; }
:where(html) .text-white.bg-green-600 { background-color: #15803d; }
:where(html) .text-white.bg-emerald-600 { background-color: #047857; }
:where(html) .text-white.bg-gray-400 { background-color: #6b7280; }
:where(html) .text-white.bg-yellow-500 { background-color: #a16207; }
:where(html) .text-white.bg-amber-500 { background-color: #b45309; }
:where(html) .text-white.bg-rose-500 { background-color: #e11d48; }
:where(html) .text-white.bg-orange-500 { background-color: #c2410c; }
:where(html) .text-white.bg-orange-500.hover\:bg-orange-600:hover { background-color: #9a3412; }

/* 6. 통계 화면 (색이 인라인이라 속성으로 지정) — 흰 카드 위 밝은 초록·주황·빨강 글씨 */
[style^="color: rgb(48, 209, 88)"], [style*="; color: rgb(48, 209, 88)"] { color: #15803d !important; }
[style^="color: rgb(255, 159, 10)"], [style*="; color: rgb(255, 159, 10)"] { color: #b45309 !important; }
[style^="color: rgb(255, 69, 58)"], [style*="; color: rgb(255, 69, 58)"] { color: #b91c1c !important; }
/* FTP 업체별 "1218성공 / 2실패" 칸이 42px 고정이라 두 줄로 꺾이던 것 */
span[style*="width: 42px"][style*="text-align: right"] { width: auto !important; min-width: 42px; white-space: nowrap; }
[style*="background-color: rgb(235, 235, 240)"] > button[style*="color: rgb(110, 110, 115)"] { color: #48484a !important; }

/* 7. PC 기사 목록(한국·미국): 칸 여백을 줄여 제목 칸을 넓힘 (넓은 화면만) */
@media (min-width: 1400px) {
  table.table-fixed { width: 100%; }
  table.table-fixed > thead > tr > th,
  table.table-fixed > tbody > tr > td { padding-left: 12px; padding-right: 12px; }
  table.table-fixed > thead > tr > th:nth-child(2) { width: 6rem; }
  table.table-fixed > thead > tr > th:nth-child(3) { width: 11.5rem; }
  table.table-fixed > thead > tr > th:nth-child(5) { width: 9rem; }
  table.table-fixed > thead > tr > th:nth-child(6) { width: 8.5rem; }
  table.table-fixed > thead > tr > th:nth-child(7) { width: 5.5rem; }
  table.table-fixed > tbody > tr > td:nth-child(3) { font-size: 14px; }
}

/* 8. 휴대폰 (640px 미만) */
@media (max-width: 639px) {
  /* 상단 상태 표시줄: 글자를 쪼개지 않고 두 줄로 */
  header > div > .ml-auto,
  header > div > .ml-auto > div { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  /* 통계 카드 5칸 → 2칸, 2단 표 → 1단 */
  [style*="grid-template-columns: repeat(5, 1fr)"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
  /* 표는 화면 안에서 옆으로 밀어 보기 */
  div:has(> table) { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  table:not(.table-fixed) td { white-space: nowrap; }
  /* FTP 설정: 업체 줄·이름 옆 알약·버튼 줄을 접어서 두 줄로 */
  .p-4.border.rounded-lg.flex.justify-between,
  .font-bold.text-lg.flex.items-center,
  .flex.items-center.space-x-4,
  .flex.items-center.space-x-6 { flex-wrap: wrap; row-gap: 6px; }
  .p-4.border.rounded-lg.flex.justify-between { gap: 8px; }
  .text-xs.px-2.rounded { white-space: nowrap; }
}

/* 기사 편집: 대표이미지 '사진 고르기' 버튼·안내 (image-pool-tool.js 인라인 색) */
.imgpool-bar > button { background: #1d4ed8 !important; }
.imgpool-bar > span { color: #5b6472 !important; }
.dark .imgpool-bar > span { color: #9ca3af !important; }

/* 기사 상세: 어두운 화면에서 바깥 틀(#f7fafc)이 밝게 남아 카드가 흰 상자에 잘려 보이던 것 */
.dark .article-detail-container { background-color: transparent; }
/* 기사 상세: 지역·카테고리 선택값이 "시/도 전…" 처럼 잘리던 것 → 줄바꿈 허용, 좁은 화면은 한 줄에 한 묶음 */
.react-select__single-value { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.3; }
@media (max-width: 1399px) {
  .grid.md\:grid-cols-2:has(.react-select__control) { grid-template-columns: minmax(0, 1fr) !important; }
}
/* 버튼 인라인 all:unset 이 줄바꿈을 되살리므로 !important */
.imgpool-bar > button { white-space: nowrap !important; flex-shrink: 0 !important; }
/* 어두운 화면: '최종 전송'·'검색' 등 bg-gray-800 버튼이 카드 바탕(#1f2937)과 같은 색이라 안 보이던 것 */
:where(.dark) .bg-gray-800.text-white { background-color: #4b5563; }
:where(.dark) .bg-gray-800.text-white:hover:not(:disabled) { background-color: #6b7280; }
@media (max-width: 639px) {
  .space-y-2 > .flex.gap-2:has(.react-select__control) { flex-direction: column; }
}

/* 9. 저작권 화면 iframe 이 음수 여백으로 화면 밖까지 나가던 것 */
div.-m-6:has(> iframe) { margin-left: 0; margin-right: 0; }
