/* TittleWorks — 공통 커스텀 스타일
   Tailwind로 처리하기 어려운 부분(스크롤바, 칸반/간트 디테일, 애니메이션)만 정의한다. */

:root {
  --tw-brand: #00611F;
  --tw-brand-soft: #ECF6EF;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  word-break: keep-all;       /* 한글 줄바꿈을 단어 단위로 자연스럽게 */
  line-break: strict;
}

/* 부드러운 스크롤바 */
.tw-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.tw-scroll::-webkit-scrollbar-track { background: transparent; }
.tw-scroll::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.tw-scroll:hover::-webkit-scrollbar-thumb { background: #cbd5e1; background-clip: content-box; }

/* 네비게이션 활성 표시 */
.nav-link { position: relative; }
.nav-link[data-active="true"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 9999px;
  background: #fff;
}

/* 진입 애니메이션 */
@keyframes tw-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tw-fade-up { animation: tw-fade-up .4s cubic-bezier(.16,1,.3,1) both; }

@keyframes tw-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.tw-fade { animation: tw-fade .25s ease both; }

/* 칸반 드래그 상태 */
.kanban-card { cursor: grab; transition: box-shadow .15s ease, transform .15s ease, opacity .15s ease; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-col.drag-over { background: var(--tw-brand-soft); outline: 2px dashed #A8D6B6; outline-offset: -4px; }

/* 진행률 바 애니메이션 */
.progress-fill { transition: width .8s cubic-bezier(.16,1,.3,1); }
@keyframes tw-spin {
  to { transform: rotate(360deg); }
}
.tw-inline-spinner { animation: tw-spin .8s linear infinite; }
@keyframes tw-progress-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}
.tw-progress-indeterminate {
  width: 35%;
  animation: tw-progress-indeterminate 1.1s ease-in-out infinite;
}

/* 간트 차트 */
.gantt-grid { background-image: linear-gradient(to right, #f1f5f9 1px, transparent 1px); }
.gantt-bar { transition: filter .15s ease; }
.gantt-bar:hover { filter: brightness(.95); }
html.dark #gantt-scroll {
  background-color: #181818 !important;
  border-color: #4a4a47 !important;
}
html.dark #gantt-scroll .bg-white {
  background-color: #20201f !important;
}
html.dark #gantt-scroll .bg-slate-50,
html.dark #gantt-scroll .bg-slate-50\/60,
html.dark #gantt-scroll .bg-slate-50\/70,
html.dark #gantt-scroll .bg-slate-100 {
  background-color: #2b2b29 !important;
}
html.dark #gantt-scroll .border-slate-100 {
  border-color: #353532 !important;
}
html.dark #gantt-scroll .border-slate-200 {
  border-color: #50504b !important;
}
html.dark #gantt-scroll .text-slate-800 {
  color: #f4f4f2 !important;
}
html.dark #gantt-scroll .text-slate-600 {
  color: #d8d8d3 !important;
}
html.dark #gantt-scroll .text-slate-500,
html.dark #gantt-scroll .text-slate-400 {
  color: #b9b9b2 !important;
}
html.dark #gantt-scroll .hover\:bg-slate-50\/60:hover {
  background-color: #32322f !important;
}
html.dark #gantt-scroll .hover\:text-indigo-600:hover {
  color: #a5b4fc !important;
}
html.dark #gantt-scroll .bg-indigo-100 {
  background-color: rgba(129, 140, 248, 0.24) !important;
}
html.dark #gantt-scroll .gantt-bar {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 14px rgba(0, 0, 0, 0.3);
}
html.dark #gantt-scroll .gantt-bar:hover {
  filter: brightness(1.08);
}
html.dark #gantt-scroll .bg-slate-400 {
  background-color: #9ca3af !important;
}
html.dark #gantt-scroll .bg-blue-500 {
  background-color: #60a5fa !important;
}
html.dark #gantt-scroll .bg-amber-500 {
  background-color: #f59e0b !important;
}
html.dark #gantt-scroll .bg-emerald-500 {
  background-color: #34d399 !important;
}
html.dark #gantt-scroll .bg-rose-500 {
  background-color: #fb7185 !important;
}
html.dark #gantt-scroll .bg-indigo-500,
html.dark #gantt-scroll .bg-indigo-600 {
  background-color: #818cf8 !important;
}

/* 캘린더 셀 */
.cal-cell { min-height: 7.5rem; }
html.dark #calendar-grid {
  background-color: #181818 !important;
  border-color: #4a4a47 !important;
}
html.dark #calendar-grid .border-slate-100 {
  border-color: #3b3b38 !important;
}
html.dark #calendar-grid .bg-white {
  background-color: #20201f !important;
}
html.dark #calendar-grid .bg-slate-50,
html.dark #calendar-grid .bg-slate-50\/60 {
  background-color: #2a2a28 !important;
}
html.dark #calendar-grid .bg-indigo-50\/40 {
  background-color: rgba(129, 140, 248, 0.18) !important;
}
html.dark #calendar-grid .text-slate-500,
html.dark #calendar-grid .text-slate-400 {
  color: #c7c7c2 !important;
}
html.dark #calendar-grid .text-slate-300 {
  color: #8d8d8a !important;
}
html.dark #calendar-grid .text-rose-400 {
  color: #fda4af !important;
}
html.dark #calendar-grid .text-blue-400 {
  color: #93c5fd !important;
}
html.dark #calendar-grid .task-row {
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}
html.dark #calendar-grid .task-row:hover {
  opacity: 1 !important;
  filter: brightness(1.08);
}
html.dark #calendar-grid .task-row.bg-slate-100 {
  background-color: #475569 !important;
  color: #f8fafc !important;
}
html.dark #calendar-grid .task-row.bg-blue-50 {
  background-color: #1d4ed8 !important;
  color: #eff6ff !important;
}
html.dark #calendar-grid .task-row.bg-amber-50 {
  background-color: #b45309 !important;
  color: #fffbeb !important;
}
html.dark #calendar-grid .task-row.bg-emerald-50 {
  background-color: #047857 !important;
  color: #ecfdf5 !important;
}
html.dark #calendar-grid .task-row.bg-rose-50 {
  background-color: #be123c !important;
  color: #fff1f2 !important;
}
html.dark #calendar-grid .task-row .opacity-70 {
  opacity: 0.9 !important;
}
html.dark #calendar-grid .task-row .bg-slate-400 {
  background-color: #e2e8f0 !important;
}
html.dark #calendar-grid .task-row .bg-blue-500 {
  background-color: #bfdbfe !important;
}
html.dark #calendar-grid .task-row .bg-amber-500 {
  background-color: #fde68a !important;
}
html.dark #calendar-grid .task-row .bg-emerald-500 {
  background-color: #bbf7d0 !important;
}
html.dark #calendar-grid .task-row .bg-rose-500 {
  background-color: #fecdd3 !important;
}

/* 토스트 */
@keyframes tw-toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tw-toast { animation: tw-toast-in .3s cubic-bezier(.16,1,.3,1) both; }

/* 모달 백드롭 */
.tw-backdrop { backdrop-filter: blur(2px); }

/* 라인 클램프 보조 */
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===========================================================
   다크 모드 — Tailwind 유틸리티를 일괄 재매핑한다.
   (개별 화면에 dark: 변형을 추가하지 않고 중립 색을 치환)
   =========================================================== */
html.dark { color-scheme: dark; }
html.dark body { background-color: #1f1f1f; }
html.dark .tw-fade,
html.dark .tw-fade-up {
  animation: none !important;
}

/* 배경 */
html.dark > body > .flex.h-screen { background-color: #1f1f1f !important; }
html.dark #tw-shell,
html.dark #scroll-main {
  background-color: #1f1f1f !important;
}
html.dark #tw-sidebar {
  background-color: #1a1a19 !important;
  background-image: none !important;
  border-right: 1px solid #313130;
}
html.dark #tw-sidebar [data-pwa-install-panel] > div {
  background-color: #242424 !important;
  border-color: #3a3a38 !important;
}
html.dark #tw-sidebar [data-pwa-install-panel] [data-action="install-pwa"] {
  background-color: #f4f4f2 !important;
  color: #1f1f1f !important;
}
html.dark #tw-sidebar [data-pwa-install-panel] [data-action="install-pwa"]:hover {
  background-color: #ffffff !important;
  color: #111827 !important;
}
html.dark header {
  background-color: rgba(31, 31, 31, 0.92) !important;
  border-color: #313130 !important;
}
html.dark .bg-white { background-color: #1f1f1f !important; }
html.dark .bg-white\/80 { background-color: rgba(31, 31, 31, 0.88) !important; }
html.dark .bg-white\/50 { background-color: rgba(31, 31, 31, 0.56) !important; }
html.dark .bg-slate-50 { background-color: #313130 !important; }
html.dark .bg-slate-100 { background-color: #313130 !important; }
html.dark .bg-slate-50\/50 { background-color: rgba(49, 49, 48, 0.5) !important; }
html.dark .bg-slate-50\/60 { background-color: rgba(49, 49, 48, 0.6) !important; }
html.dark .bg-slate-50\/40 { background-color: rgba(49, 49, 48, 0.4) !important; }
html.dark .bg-slate-100\/60 { background-color: rgba(49, 49, 48, 0.6) !important; }
html.dark .bg-slate-100\/70 { background-color: rgba(49, 49, 48, 0.7) !important; }
html.dark .bg-indigo-50\/40 { background-color: rgba(99, 102, 241, 0.12) !important; }
html.dark .bg-indigo-50\/30 { background-color: rgba(99, 102, 241, 0.1) !important; }
html.dark .bg-rose-50 { background-color: rgba(127, 29, 29, 0.3) !important; }
html.dark .bg-rose-50\/40 { background-color: rgba(127, 29, 29, 0.24) !important; }
html.dark .bg-rose-100 { background-color: rgba(153, 27, 27, 0.36) !important; }
html.dark .bg-rose-200 { background-color: rgba(190, 18, 60, 0.4) !important; }
html.dark #tw-sidebar .bg-white\/15,
html.dark [data-active="true"].nav-link,
html.dark #settings-nav .bg-indigo-50 {
  background-color: #313130 !important;
  color: #f4f4f2 !important;
}

/* 텍스트 */
html.dark .text-slate-900 { color: #f1f5f9 !important; }
html.dark .text-slate-800 { color: #e2e8f0 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600 { color: #94a3b8 !important; }
html.dark .text-slate-500 { color: #94a3b8 !important; }
html.dark .text-slate-400 { color: #8d8d8a !important; }
html.dark .text-slate-300 { color: #aaa9a5 !important; }
html.dark .text-rose-800 { color: #fecdd3 !important; }
html.dark .text-rose-700 { color: #fda4af !important; }
html.dark .text-rose-600 { color: #fb7185 !important; }
html.dark .text-rose-500 { color: #fb7185 !important; }

/* 테두리 */
html.dark .border-slate-200 { border-color: #313130 !important; }
html.dark .border-slate-100 { border-color: #313130 !important; }
html.dark .border-slate-50 { border-color: #313130 !important; }
html.dark .border-rose-200 { border-color: rgba(244, 63, 94, 0.42) !important; }
html.dark .border-rose-100 { border-color: rgba(244, 63, 94, 0.28) !important; }
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-50 > :not([hidden]) ~ :not([hidden]) { border-color: #313130 !important; }

html.dark #approval-requests .bg-white {
  background-color: #242424 !important;
}
html.dark #approval-requests .bg-amber-50,
html.dark #approval-requests .bg-amber-50\/70 {
  background-color: rgba(146, 64, 14, 0.24) !important;
}
html.dark #approval-requests .border-amber-100 {
  border-color: rgba(245, 158, 11, 0.42) !important;
}
html.dark #approval-requests .text-amber-700 {
  color: #fcd34d !important;
}
html.dark #approval-requests .text-slate-800 {
  color: #f1f5f9 !important;
}
html.dark #approval-requests .text-slate-400,
html.dark #approval-requests .text-slate-500 {
  color: #c4c4bd !important;
}
html.dark #approval-requests tr.border-amber-100 {
  border-color: rgba(245, 158, 11, 0.24) !important;
}
html.dark #approval-requests .ring-amber-200 {
  --tw-ring-color: rgba(245, 158, 11, 0.55) !important;
}
html.dark #approval-requests button.border-slate-200 {
  background-color: #2f2f2d !important;
  border-color: #4a4a47 !important;
  color: #d6d3d1 !important;
}
html.dark #approval-requests button.border-slate-200:hover {
  background-color: rgba(127, 29, 29, 0.26) !important;
  border-color: rgba(244, 63, 94, 0.42) !important;
  color: #fda4af !important;
}

/* 호버 */
html.dark .hover\:bg-slate-50:hover { background-color: #3a3a38 !important; }
html.dark .hover\:bg-slate-100:hover { background-color: #3a3a38 !important; }
html.dark .hover\:bg-indigo-50\/40:hover { background-color: rgba(99, 102, 241, 0.14) !important; }

/* 폼 요소 */
html.dark input, html.dark textarea, html.dark select {
  background-color: #313130 !important;
  color: #e2e8f0 !important;
  border-color: #313130 !important;
}
html.dark input::placeholder, html.dark textarea::placeholder { color: #8d8d8a !important; }

/* 검색 폼 */
html.dark header [data-action="search"] {
  background-color: #242424 !important;
  border-color: #4a4a47 !important;
  color: #d8d8d3 !important;
}
html.dark header [data-action="search"]:hover {
  background-color: #30302e !important;
  border-color: #818cf8 !important;
  color: #f4f4f2 !important;
}
html.dark header [data-action="search"] svg {
  color: #c7c7c2 !important;
}
html.dark header [data-action="search"] kbd {
  background-color: #1f1f1f !important;
  border-color: #5a5a55 !important;
  color: #c7c7c2 !important;
}
html.dark #tw-search {
  background-color: rgba(0, 0, 0, 0.62) !important;
}
html.dark #tw-search > div {
  background-color: #20201f !important;
  border: 1px solid #3f3f3b;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52) !important;
}
html.dark #tw-search > div > div:first-child {
  background-color: #242424 !important;
  border-color: #4a4a47 !important;
}
html.dark #tw-search > div > div:first-child svg {
  color: #c7c7c2 !important;
}
html.dark #tw-search-input {
  background-color: transparent !important;
  color: #f4f4f2 !important;
}
html.dark #tw-search-input::placeholder {
  color: #aaa9a5 !important;
}
html.dark #tw-search kbd {
  background-color: #1f1f1f !important;
  border-color: #5a5a55 !important;
  color: #c7c7c2 !important;
}
html.dark #tw-search-results {
  background-color: #20201f !important;
}
html.dark #tw-search-results .search-row {
  color: #f4f4f2 !important;
}
html.dark #tw-search-results .search-row:hover {
  background-color: #30302e !important;
}
html.dark #tw-search-results .search-row.bg-indigo-50 {
  background-color: rgba(79, 70, 229, 0.28) !important;
}
html.dark #tw-search-results .search-row .bg-slate-50 {
  background-color: #313130 !important;
}
html.dark #tw-search-results .search-row .ring-white {
  --tw-ring-color: #20201f !important;
}
html.dark #tw-search-results .text-slate-800 {
  color: #f4f4f2 !important;
}
html.dark #tw-search-results .text-slate-400 {
  color: #b7b7b2 !important;
}
html.dark #tw-search-results .text-indigo-400 {
  color: #a5b4fc !important;
}
html.dark #proj-search,
html.dark input#f-q {
  background-color: #242424 !important;
  border-color: #4a4a47 !important;
  color: #f4f4f2 !important;
}
html.dark #proj-search::placeholder,
html.dark input#f-q::placeholder {
  color: #aaa9a5 !important;
}
html.dark #proj-search:focus,
html.dark input#f-q:focus {
  border-color: #818cf8 !important;
  --tw-ring-color: rgba(129, 140, 248, 0.32) !important;
}
html.dark #search-ic,
html.dark input#f-q + span,
html.dark span:has(+ input#f-q) {
  color: #c7c7c2 !important;
}

/* 댓글 멘션 후보 목록 */
html.dark #task-mention-panel,
html.dark #drawer-mention-panel {
  background-color: #242424 !important;
  border-color: #3f3f46 !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36) !important;
}
html.dark #task-mention-panel [data-mention],
html.dark #drawer-mention-panel [data-mention] {
  color: #e4e4e7 !important;
}
html.dark #task-mention-panel [data-mention].bg-indigo-50,
html.dark #drawer-mention-panel [data-mention].bg-indigo-50 {
  background-color: rgba(79, 70, 229, 0.26) !important;
}
html.dark #task-mention-panel [data-mention]:hover,
html.dark #drawer-mention-panel [data-mention]:hover {
  background-color: #303030 !important;
}
html.dark #task-mention-panel .text-slate-700,
html.dark #drawer-mention-panel .text-slate-700 {
  color: #f4f4f5 !important;
}
html.dark #task-mention-panel .text-slate-400,
html.dark #drawer-mention-panel .text-slate-400 {
  color: #b7b7b2 !important;
}
html.dark #task-mention-panel .ring-white,
html.dark #drawer-mention-panel .ring-white {
  --tw-ring-color: #3f3f46 !important;
}

/* 새 프로젝트: 참여자 선택 토글 */
html.dark #project-form #member-toggles .member-toggle {
  background-color: #242424 !important;
  border-color: #4a4a47 !important;
  color: #d8d8d3 !important;
}
html.dark #project-form #member-toggles .member-toggle:hover:not(:disabled) {
  background-color: #30302e !important;
  border-color: #71716b !important;
  color: #f4f4f2 !important;
}
html.dark #project-form #member-toggles .member-toggle[data-selected="true"] {
  background-color: rgba(79, 70, 229, 0.26) !important;
  border-color: #818cf8 !important;
  color: #e0e7ff !important;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.18);
}
html.dark #project-form #member-toggles .member-toggle:disabled {
  opacity: 1 !important;
}
html.dark #project-form #member-toggles .member-toggle .ring-white {
  --tw-ring-color: #242424 !important;
}
html.dark #project-form #member-toggles .member-toggle[data-selected="true"] .ring-white {
  --tw-ring-color: rgba(79, 70, 229, 0.42) !important;
}
html.dark #project-form #member-toggles .member-owner-badge {
  background-color: rgba(129, 140, 248, 0.22) !important;
  color: #c7d2fe !important;
}
html.dark #project-form #member-toggles .member-check svg {
  color: #a5b4fc !important;
}

/* 스크롤바 */
html.dark .tw-scroll::-webkit-scrollbar-thumb { background: #3a3a38; background-clip: content-box; }
html.dark .tw-scroll:hover::-webkit-scrollbar-thumb { background: #4a4a47; background-clip: content-box; }

/* 부드러운 테마 전환 */
body, .bg-white, aside { transition: background-color .2s ease, border-color .2s ease; }
