/* mon 다크 테마 (2026-09-09)
 *
 * ## 왜 유틸리티 클래스를 고치지 않고 여기서 덮는가
 *
 * 화면 20개에 `bg-white`·`text-gray-500` 같은 밝은 유틸리티가 670군데쯤
 * 박혀 있고, 그 중 상당수는 JS 템플릿 문자열 안에서 만들어진다(표·카드가
 * 그렇다). 전부 `dark:` 변형으로 고치면 diff 가 수백 줄이 되고, 새 화면을
 * 추가할 때마다 빠뜨린 곳이 흰 판때기로 남는다.
 *
 * 그래서 **팔레트만 뒤집는다**. Tailwind 가 만든 규칙을 같은 이름으로
 * 다시 정의해 색만 바꾸므로, 앞으로 어느 화면에서 `bg-white` 를 쓰든
 * 자동으로 어두워진다. 명도 순서(50 이 가장 밝음)는 뒤집어 매핑한다 —
 * 밝은 배경일수록 어두운 배경이 되어야 층이 유지된다.
 *
 * Tailwind play CDN(v3)이 <style> 를 런타임에 주입하므로, 이 파일은
 * 그보다 뒤에 오는 <link> 로 싣고 몇 곳은 !important 로 못박는다.
 *
 * 색은 slate 계열 한 벌로 통일했다:
 *   바닥 #0f1419 · 카드 #1a2027 · 경계 #2a333d · 글자 #e5e9ee
 */

:root {
  /* 명도는 눈대중이 아니라 대비비로 정했다(WCAG). 카드와 바닥이 1.13:1 이면
     층이 안 보여서 1.27:1 까지 벌렸고, --text-4 는 3.46:1(불합격)이라
     4.95:1 로 올렸다 — 이 색이 화면에서 213번 쓰여 가장 많이 읽힌다. */
  --bg:        #0a0e12;  /* 페이지 바닥 */
  --surface:   #1e262f;  /* 카드 — 바닥 대비 1.27:1 */
  --surface-2: #262f39;  /* 카드 위의 옅은 블록(코드·표 머리) */
  --border:    #2f3a45;
  --border-2:  #3a4653;
  --text:      #e8ecf1;  /* 13.5:1 */
  --text-2:    #b8c1cb;  /*  8.5:1 */
  --text-3:    #9aa4af;  /*  6.2:1 */
  --text-4:    #87929d;  /*  4.95:1 — AA 통과 */
}

html, body { background: var(--bg) !important; color: var(--text); }

/* ---- 배경 --------------------------------------------------------------
 * 밝기 순서를 뒤집는다: 흰색·50·100 이 위로 올라온 면(카드)이므로 바닥보다
 * 밝은 표면색을 준다. */
.bg-white     { background-color: var(--surface) !important; }
.bg-gray-50   { background-color: var(--surface-2) !important; }
.bg-gray-100  { background-color: var(--surface-2) !important; }
.bg-gray-200  { background-color: var(--border-2) !important; }

/* 사이드바·모바일 헤더는 원래 어두웠다. 바닥과 붙어 경계가 사라지지
 * 않도록 오히려 한 톤 더 어둡게 깔고 오른쪽 경계로 나눈다. */
.bg-gray-900  { background-color: #05080b !important; }
.bg-gray-800  { background-color: var(--surface-2) !important; }

/* ---- 글자 --------------------------------------------------------------
 * 900(가장 진함)이 가장 밝은 글자가 된다. */
.text-gray-900 { color: var(--text)   !important; }
.text-gray-800 { color: var(--text)   !important; }
.text-gray-700 { color: var(--text-2) !important; }
.text-gray-600 { color: var(--text-2) !important; }
.text-gray-500 { color: var(--text-3) !important; }
.text-gray-400 { color: var(--text-4) !important; }
.text-gray-300 { color: var(--text-2) !important; }  /* 사이드바 메뉴 글자 */
.text-white    { color: #fff !important; }

/* ---- 경계 -------------------------------------------------------------- */

/* 색을 안 준 테두리(`class="border"`, `border-t` 등)는 Tailwind 기본
   #e5e7eb 가 그대로 나온다. 카드 배경 대비 12.35:1 — MON dev 표준 테두리
   (1.32:1)보다 9배 튀어, 어두운 화면에 흰 줄이 그어진 것처럼 보인다.
   입력칸·배지·대화창 등 12곳이 이 상태였다(실측 2026-09-10).
   개별로 고치면 다음에 또 생기므로 기본값 자체를 여기서 잡는다. */
.border, .border-t, .border-b, .border-l, .border-r, .border-x, .border-y {
  border-color: var(--border-2);
}

.border-gray-100 { border-color: var(--border)   !important; }
.border-gray-200 { border-color: var(--border-2) !important; }
.border-gray-300 { border-color: var(--border-2) !important; }
/* 사이드바 구분선. 바닥이 #05080b 라 1.33:1 로는 안 보여서 올렸다. */
.border-gray-800 { border-color: #2a3540 !important; }
.divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border-2) !important; }

/* 카드 색은 _layout.html 의 .card 가 여기 변수를 직접 쓰므로 덮을 게 없다.
   (예전엔 거기 #fff 가 박혀 있어 !important 로 눌렀었다) */

/* ---- 의미색 배경 -------------------------------------------------------
 * 옅은 안내 박스(빨강·노랑·초록·파랑)를 그대로 두면 어두운 바닥에서
 * 형광등처럼 튄다. 같은 색조를 어둡게 깔고 글자만 밝게 남긴다. */
.bg-red-50    { background-color: #2c1618 !important; }
.bg-amber-50  { background-color: #2b2113 !important; }
.bg-yellow-50 { background-color: #2b2113 !important; }
.bg-green-50  { background-color: #12251a !important; }
.bg-blue-50   { background-color: #12203a !important; }
.bg-orange-50 { background-color: #2c1d13 !important; }
.bg-red-100   { background-color: #3a1d20 !important; }
.bg-amber-100 { background-color: #3a2c19 !important; }
.bg-orange-100 { background-color: #3a2617 !important; }
.bg-green-100 { background-color: #183322 !important; }
.bg-blue-100  { background-color: #17294a !important; }

.border-red-200    { border-color: #5b2a2e !important; }
.border-amber-200  { border-color: #5a4423 !important; }
.border-yellow-200 { border-color: #5a4423 !important; }
.border-green-200  { border-color: #22492f !important; }
.border-blue-200   { border-color: #24406e !important; }
.border-red-400    { border-color: #b04a4a !important; }
.border-amber-400  { border-color: #b08a3a !important; }
.border-blue-400   { border-color: #4a7fc1 !important; }
.border-green-400  { border-color: #3f9160 !important; }
/* 테두리로 표시하는 상태 칩(캠핑 날짜판)용. 채움과 달리 배경이 어두운
   채로 남으므로, 테두리·글자 모두 다크 바닥에서 읽히도록 밝게 잡는다. */
.border-green-500  { border-color: #4ec97f !important; }
.text-green-500    { color: #6ddc95 !important; }
/* 캠핑 "예약됨" 칩용. 주동작색이 그린이 된 뒤로 초록 칩과 헷갈려
   파랑으로 옮겼다(2026-09-10) — 색상이 아예 달라 한눈에 갈린다. */
/* 사용량 막대(<75%)·작업 대상 고정 점. 매핑이 없으면 Tailwind 기본
   #3b82f6 이 나와 다른 파랑과 톤이 어긋난다. */
.bg-blue-500       { background-color: #5f9fe0 !important; }
.border-sky-400    { border-color: #5f9fe0 !important; }
.text-sky-400      { color: #7fb3ff !important; }
.border-orange-400 { border-color: #f0a56b !important; }
.text-orange-400   { color: #f0a56b !important; }

/* 의미색 글자 — 어두운 바닥에서 읽히도록 한 단계 밝게 */
.text-red-900,   .text-red-800,   .text-red-700,   .text-red-600   { color: #ff8b8b !important; }
.text-amber-900, .text-amber-800, .text-amber-700, .text-amber-600 { color: #f0c274 !important; }
.text-yellow-900,.text-yellow-800,.text-yellow-700,.text-yellow-600{ color: #f0c274 !important; }
.text-green-900, .text-green-800, .text-green-700, .text-green-600 { color: #6ddc95 !important; }
/* 링크 글자는 파랑을 지킨다. 주동작색을 MON 그린으로 옮길 때 여기까지
   초록으로 끌고 갔더니 "누를 수 있는 글자" 라는 신호가 약해졌다 —
   링크=파랑은 웹의 오랜 관례라 글 속에서 눈이 먼저 찾는다.
   브랜드는 버튼·선택 표시가 담당한다(2026-09-10). */
.text-blue-900,  .text-blue-800,  .text-blue-700,  .text-blue-600  { color: #7fb3ff !important; }
.text-orange-900,.text-orange-800,.text-orange-700,.text-orange-600{ color: #f0a56b !important; }

/* 채워진 주버튼 — 파랑(#5f9fe0).
 *
 * 한동안 MON 로고 그린(#01d959)으로 칠했지만, 이 화면에서 초록은 이미
 * "정상·실행 중" 을 뜻한다(상태 점·배지·정상 N/N 글자). 주버튼까지 같은
 * 초록이면 누를 것과 상태가 한 색으로 읽힌다 — 2026-09-13 에 파랑으로
 * 옮겼다.
 *
 * 색 규칙: 초록은 **선택된 메뉴·정상 상태·Chat(AI)** 셋만 쓰고,
 * 나머지는 전부 서브컬러인 이 파랑을 쓴다.
 *
 * 여기 값(#5f9fe0)은 이제 버튼용이 아니다 — 버튼은 전부 .btn-blue
 * (#4a63af, _layout.html)로 옮겼다. 이 규칙은 유틸리티를 직접 쓴 자리
 * (배너 등)에만 남아 있다. 버튼에 이 클래스를 다시 붙이지 말 것.
 *
 * 흰 글자는 이 배경에서 대비가 모자라므로 밝은 배경에 어두운 글자를 얹는다.
 * `.text-white` 가 !important 로 흰색을 박으므로 여기서 다시 눌러야 한다.
 * 선택자를 겹쳐 특이도를 올린다(같은 !important 끼리는 특이도가 이긴다). */
.bg-blue-600 { background-color: #5f9fe0 !important; }
.bg-blue-600:hover, .hover\:bg-blue-700:hover { background-color: #7fb3ff !important; }
.bg-blue-600, .bg-blue-600.text-white,
.bg-blue-600 > .text-white, .bg-blue-600 > span, .bg-blue-600 > i,
.bg-blue-600 > svg { color: #0b1b33 !important; }

/* ---- hover ------------------------------------------------------------- */
.hover\:bg-gray-50:hover  { background-color: var(--surface-2) !important; }
.hover\:bg-gray-100:hover { background-color: #2b343e !important; }
.hover\:bg-gray-800:hover { background-color: #222c36 !important; }
.hover\:text-gray-600:hover, .hover\:text-gray-700:hover,
.hover\:text-gray-900:hover { color: var(--text) !important; }
.hover\:text-white:hover    { color: #fff !important; }

/* ---- 폼 ---------------------------------------------------------------- */
input, select, textarea {
  background-color: var(--surface-2) !important;
  border-color: var(--border-2) !important;
  color: var(--text) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-4) !important; }
input:disabled, select:disabled, button:disabled { opacity: .55; }

/* 코드·로그 블록 */
pre, code { color: var(--text-2); }
pre { background-color: var(--surface-2) !important; }

/* 표 머리 */
thead, th { background-color: var(--surface-2) !important; color: var(--text-2) !important; }
tbody tr:hover { background-color: #222c36 !important; }

/* ---- wiple-ui.css 의 액션 버튼 (밝은 배경 전제라 다시 칠한다) ---------- */
.link-blue         { color: #7fb3ff !important; background: #17294a !important; }
.link-blue:hover   { background: #1d3560 !important; }
.link-red          { color: #ff8b8b !important; background: #3a1d20 !important; }
.link-red:hover    { background: #4a2429 !important; }
.link-green        { color: #6ddc95 !important; background: #183322 !important; }
.link-green:hover  { background: #1e422c !important; }
.link-yellow       { color: #f0c274 !important; background: #3a2c19 !important; }
.link-yellow:hover { background: #4a3820 !important; }
.link-orange       { color: #f0a56b !important; background: #3a2617 !important; }
.link-orange:hover { background: #4a301d !important; }
.link-disabled     { color: var(--text-4) !important; background: var(--surface-2) !important; }

/* 모달 — wiple-ui.css 가 흰 배경을 준다 */
.modal, .modal-content, .modal-body, .modal-header, .modal-footer {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* 스크롤바 */
* { scrollbar-color: #3a444f var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3a444f; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #4a545f; }

/* 브라우저 기본 UI(폼 컨트롤·스크롤바)도 어두운 쪽으로 */
:root { color-scheme: dark; }


/* ---- 접근성 -------------------------------------------------------------
 * 사이드바가 유일하게 움직이는 요소(모바일 서랍)다. 전정기관 자극을 피해야
 * 하는 사용자에겐 미끄러짐 대신 즉시 나타나게 한다. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --surface: #232c36; --border: #4a5764; --border-2: #5a6773;
    --text-3: #b0bac4; --text-4: #a2acb7;
  }
}

/* 키보드 이동 경로가 보여야 한다. 마우스 클릭엔 안 뜨도록 focus-visible 만. */
:focus-visible {
  outline: 2px solid #01d959 !important;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- 토스트 -------------------------------------------------------------
 * 토스트는 bg-gray-900 인데, 위에서 그 클래스를 사이드바용 near-black 으로
 * 매핑해 버려 어두운 바닥 위에서 안 보인다. 떠 있는 알림이므로 오히려
 * 바닥보다 **밝아야** 한다 — 클래스가 아니라 자기 자리에서 다시 칠한다. */
#toast-box > div {
  background-color: #313c48 !important;
  color: var(--text) !important;
  border: 1px solid var(--border-2);
  box-shadow: 0 8px 24px rgb(0 0 0 / .5) !important;
}


/* ---- 빠뜨린 회색들 ------------------------------------------------------
 * 처음 매핑에서 빠져 라이트 기본값(#e5e7eb)이 그대로 나오던 것들이다.
 * 표의 가로줄이 어두운 바닥에서 하얗게 그어지던 원인. */
.border-gray-50  { border-color: var(--border) !important; }
.border-gray-700 { border-color: #3d4854 !important; }
.divide-gray-50  > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }
.divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }

.bg-gray-700 { background-color: #333d49 !important; }

/* bg-gray-300 은 "중지·미상" 상태 점이다. 어두운 바닥에서 밝은 회색이면
   꺼진 것이 오히려 눈에 띄므로, 살아있는 초록보다 물러나 보이게 낮춘다. */
.bg-gray-300 { background-color: #48535f !important; }

/* 색을 안 준 border/border-b/border-t 는 Tailwind 기본값(#e5e7eb)이라
   그대로 두면 흰 줄이 된다. 요소 기준으로 기본 테두리색을 바꾼다. */
*, *::before, *::after { border-color: var(--border); }

/* ---- 표 정리 ------------------------------------------------------------
 * 줄마다 선을 긋는 대신 머리글만 경계를 갖고 행은 여백으로 나눈다.
 * 어두운 화면에서 가로줄이 많으면 내용보다 격자가 먼저 읽힌다. */
table { border-collapse: collapse; }
thead th {
  border-bottom: 1px solid var(--border-2) !important;
  font-weight: 600;
  letter-spacing: .02em;   /* 작은 대문자/라벨은 살짝 벌려야 읽힌다 */
}
tbody td { border-bottom: 1px solid var(--border) !important; }
tbody tr:last-child td { border-bottom: 0 !important; }


/* 보라 배지 (한 곳에서 쓴다) */
.bg-purple-50   { background-color: #241a35 !important; }
.text-purple-700, .text-purple-600 { color: #c4a5f0 !important; }
.border-purple-200 { border-color: #46356b !important; }

/* ---- 그림자 -------------------------------------------------------------
 * 밝은 배경에서 쓰던 옅은 검정 그림자는 어두운 바닥에서 보이지 않는다.
 * 어두운 UI 에서 높이는 그림자보다 **테두리 밝기**로 읽히므로, 그림자는
 * 더 진하게 깔고 떠 있는 것(모달·토스트)엔 옅은 윤곽선을 같이 준다. */
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / .4) !important; }
.shadow-lg { box-shadow: 0 8px 24px rgb(0 0 0 / .5) !important; }
.shadow-xl {
  box-shadow: 0 16px 48px rgb(0 0 0 / .6) !important;
  border: 1px solid var(--border-2);
}


/* ---- 배지·버튼의 옅은 테두리 -------------------------------------------
 * 위에서 bg-*-50 을 어둡게 칠했는데 테두리는 밝은 채로 남아, 어두운 알약에
 * 흰 테가 둘린 꼴이었다. 채워진 색과 같은 계열로 낮춘다.
 * (bg-*-500/600 같은 진한 점·버튼은 어두운 바닥에서도 잘 보여 그대로 둔다) */
.border-red-100,   .border-red-300   { border-color: #5b2a2e !important; }
.border-amber-100, .border-amber-300 { border-color: #5a4423 !important; }
.border-green-100, .border-green-600 { border-color: #22492f !important; }
.border-blue-100                     { border-color: #24406e !important; }

/* 500 짜리 테두리는 강조용이라 한 톤만 낮춘다 */
.border-blue-500 { border-color: #3b6ab5 !important; }
.border-blue-300 { border-color: #3b6ab5 !important; }
/* 포커스 링 — 파랑이던 것을 그린으로. 다크 바닥에서 보이려면 밝아야 한다. */
.ring-blue-500 { --tw-ring-color: #4a8fd4 !important; }
/* bg-blue-700 은 hover 로 주로 쓰인다 — 주버튼 hover 와 같은 값 */
.bg-blue-700 { background-color: #7fb3ff !important; }
.text-blue-200 { color: #bcd8ff !important; }

/* 옅은 배경 위 500 계열 글자 — 어두워진 배경에서 읽히게 */
.text-red-500   { color: #ff8b8b !important; }
.text-amber-500 { color: #f0c274 !important; }
.text-blue-500  { color: #7fb3ff !important; }


/* 켜진 토글(초록 채움 + 흰 글자). Tailwind 기본 green-600 은 흰 글자와
   3.30:1 이라 AA 미달이라 한 톤 낮춰 4.9:1 로 맞춘다. */
.bg-green-600 { background-color: #15803d !important; }
