/* 버전 2(신규 LMS 화면 체계) 미리보기 전용 덮어쓰기 — /v2/ 에서만 불러온다(functions/v2/[[path]].js).
   운영 화면(/)은 이 파일을 모른다. 모든 규칙은 html[data-ui="v2"] 아래에서만 동작해야 한다.
   단계별로 이 파일에 쌓고, 사용자가 눈으로 보고 승인하면 운영 style.css로 옮긴다.
   설계: docs/superpowers/specs/2026-10-13-lms-ux-reskin-design.md */

/* ── 1단계: 글꼴 + 기본 토큰을 신규 LMS 값(--ds-*)에 연결 ──────────────────
   두 번째 선택자는 OS 다크일 때의 기존 다크 블록(:root:not([data-theme='light']),
   명시도 0,2,0)보다 강하게 하려고 둔다. 상태 칩 색 토큰·강조색은 손대지 않는다(2026-10-01 확정 칩 규칙). */
:root[data-ui="v2"],
:root[data-ui="v2"]:not([data-theme="light"]) {
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  --bg: var(--ds-background);
  --surface: var(--ds-card);
  --card: var(--ds-card);
  --border: var(--ds-border);
  --text-1: var(--ds-foreground);
  --text-2: var(--ds-muted-foreground);
  --sv-foreground: var(--ds-card-foreground);
  --sv-muted-foreground: var(--ds-muted-foreground);
  --sv-border: var(--ds-border);
  --sv-card: var(--ds-card);
  --sv-surface-alt: var(--ds-background);
  --sv-muted: var(--ds-muted);
  --sv-input-bg: var(--ds-background);
  /* 기존 다크 토큰(#1a2235 카드, #64748b 3차 글자 …)을 LMS 값으로 — 3단계 */
  --card-bg: var(--ds-card);
  --card-border: var(--ds-border);
  --surface-subtle: var(--ds-card);
  --input-bg: var(--ds-background);
  --input-border: var(--ds-input);
  --text-3: var(--ds-muted-foreground);
  --text-primary: var(--ds-foreground);
  --text-secondary: var(--ds-muted-foreground);
  --color-border: var(--ds-border);
}

/* ── 미리보기 표지 — 화면 아래 가운데. 링크만 클릭되고 나머지는 클릭이 뒤로 통과한다 ── */
html[data-ui="v2"] .v2-preview-badge {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 9997;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--ds-sidebar);
  color: var(--ds-sidebar-foreground);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1;
  box-shadow: var(--ds-shadow-card-hover);
  pointer-events: none;
  white-space: nowrap;
}

html[data-ui="v2"] .v2-preview-badge strong {
  color: #fda4af;
  font-weight: 700;
}

html[data-ui="v2"] .v2-preview-badge span {
  color: var(--ds-sidebar-muted);
}

html[data-ui="v2"] .v2-preview-badge a {
  pointer-events: auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ds-primary);
  color: var(--ds-primary-foreground);
  font-weight: 600;
  text-decoration: none;
}

html[data-ui="v2"] .v2-preview-badge a:hover {
  background: var(--ds-primary-hover);
}

/* ── 2단계: 앱 뼈대 — 어두운 240px 사이드바 + 64px 머리글 ─────────────────────
   v2.js가 기존 탭·버튼 요소를 새 위치로 옮겨 놓는다(id·핸들러 유지). 여기서는 모양만 바꾼다.
   상태 칩 색 규칙은 건드리지 않는다. */
html[data-ui="v2"] {
  --v2-sidebar-w: 240px;
  --v2-header-h: 64px;
}
/* 글자 크기: 기본 = 본문 14px(운영은 13px — 신규 LMS 메뉴·버튼 14px에 맞춤), 보조 글자 최소 11px.
   크게/아주 크게는 +1/+2px. --fs-* 토큰을 쓰는 글자만 따라 커진다. */
html[data-ui="v2"][data-font-step="0"] { --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; }
html[data-ui="v2"][data-font-step="1"] { --fs-2xs: 12px; --fs-xs: 13px; --fs-sm: 14px; --fs-base: 15px; --fs-md: 16px; --fs-lg: 18px; }
html[data-ui="v2"][data-font-step="2"] { --fs-2xs: 13px; --fs-xs: 14px; --fs-sm: 15px; --fs-base: 16px; --fs-md: 17px; --fs-lg: 19px; }


html[data-ui="v2"] .sidebar {
  width: var(--v2-sidebar-w);
  background: var(--ds-sidebar);
  border-right: 0;
  color: var(--ds-sidebar-foreground);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
html[data-ui="v2"] .sidebar-brand {
  height: var(--v2-header-h);
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--ds-sidebar-divider);
}
html[data-ui="v2"] .brand-name { color: var(--ds-sidebar-foreground); font-size: 16px; font-weight: 700; }
html[data-ui="v2"] .nav-label {
  color: var(--ds-sidebar-muted);
  padding: 20px 20px 8px;
}

/* 메뉴(= 기존 #view-tabs) */
html[data-ui="v2"] .view-tabs.v2-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 0 12px;
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  flex-shrink: 0;
}
html[data-ui="v2"] .v2-menu .view-tab {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ds-sidebar-muted);
  font-size: 14px;
  font-weight: 500;
  justify-content: flex-start;
  box-shadow: none;
  transform: none;
}
html[data-ui="v2"] .v2-menu .view-tab::before,
html[data-ui="v2"] .v2-menu .view-tab::after { display: none; }
html[data-ui="v2"] .v2-menu .view-tab:hover {
  background: var(--ds-sidebar-hover);
  color: var(--ds-sidebar-foreground);
  border: 0;
  transform: none;
}
html[data-ui="v2"] .v2-menu .view-tab.active {
  background: var(--ds-sidebar-hover);
  color: #fff;
  font-weight: 700;
}
/* 고른 항목: 왼쪽 로즈 세로 막대 3px × 16px */
html[data-ui="v2"] .v2-menu .view-tab.active::before {
  display: block;
  content: "";
  position: absolute;
  inset: auto;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  margin-top: -8px;
  border-radius: 0 3px 3px 0;
  background: var(--ds-primary);
  opacity: 1;
  z-index: 0;
}
html[data-ui="v2"] .v2-menu .view-tab .tab-icon { width: 18px; height: 18px; flex-basis: 18px; }

/* 하위 메뉴(그룹 아래로 들어간 .subview-tabs) */
html[data-ui="v2"] .v2-menu .subview-tabs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  margin: 0 0 6px 21px;
  padding: 0 0 0 10px;
  background: none;
  border: 0;
  border-left: 1px solid var(--ds-sidebar-divider);
  overflow: visible;
}
html[data-ui="v2"] .v2-menu .subview-tabs.hidden { display: none; }
html[data-ui="v2"] .v2-menu .subview-tabs::before { display: none; }
html[data-ui="v2"] .v2-menu .subview-tab {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ds-sidebar-muted);
  font-size: 13px;
  font-weight: 500;
  justify-content: flex-start;
  box-shadow: none;
  transform: none;
}
html[data-ui="v2"] .v2-menu .subview-tab::before,
html[data-ui="v2"] .v2-menu .subview-tab::after { display: none; }
html[data-ui="v2"] .v2-menu .subview-tab:hover { background: var(--ds-sidebar-hover); color: var(--ds-sidebar-foreground); }
html[data-ui="v2"] .v2-menu .subview-tab.active {
  background: var(--ds-primary-soft);
  color: #fda4af;
  font-weight: 700;
}
html[data-ui="v2"] .v2-menu .subview-tab__index { display: none; }

/* 담당자 필터·이벤트 타입(사이드바 아래쪽) — 어두운 바탕용 색 */
html[data-ui="v2"] .sidebar .nav-item { color: var(--ds-sidebar-muted); border-radius: 10px; }
html[data-ui="v2"] .sidebar .nav-item:hover { background: var(--ds-sidebar-hover); color: var(--ds-sidebar-foreground); }
html[data-ui="v2"] .sidebar .nav-item.active { background: var(--ds-sidebar-hover); color: #fff; }
html[data-ui="v2"] .sidebar .milestone-toggles label { color: var(--ds-sidebar-muted); }
html[data-ui="v2"] .sidebar .milestone-toggles hr { border-color: var(--ds-sidebar-divider); }
html[data-ui="v2"] .sidebar .sidebar-section { color: var(--ds-sidebar-muted); }
/* 비어버린 하단 상자(버튼은 머리글로 옮겨 감) */
html[data-ui="v2"] .sidebar-footer { display: none; }

/* 머리글 */
html[data-ui="v2"] .v2-header {
  position: sticky;
  top: 0;
  z-index: 60;
  flex-shrink: 0;
  box-sizing: border-box;
  height: var(--v2-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--ds-card) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ds-border);
}
html[data-ui="v2"] .v2-header__title { min-width: 0; }
html[data-ui="v2"] .v2-header__h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ds-foreground);
  white-space: nowrap;
}
html[data-ui="v2"] .v2-header__desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ds-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-ui="v2"] .v2-header__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
html[data-ui="v2"] .v2-header__tools > * { margin: 0; }
html[data-ui="v2"] .v2-header .top-health-btn,
html[data-ui="v2"] .v2-header .refresh-btn,
html[data-ui="v2"] .v2-header .footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ds-border);
  border-radius: 12px;
  background: var(--ds-card);
  color: var(--ds-card-foreground);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-ui="v2"] .v2-header .top-health-btn::before,
html[data-ui="v2"] .v2-header .top-health-btn::after,
html[data-ui="v2"] .v2-header .footer-btn::before,
html[data-ui="v2"] .v2-header .footer-btn::after { display: none; }
html[data-ui="v2"] .v2-header .top-health-btn:hover,
html[data-ui="v2"] .v2-header .refresh-btn:hover,
html[data-ui="v2"] .v2-header .footer-btn:hover {
  background: var(--ds-muted);
  transform: none;
}
html[data-ui="v2"] .v2-header .footer-btn.danger { color: var(--ds-danger); }
html[data-ui="v2"] .v2-header .footer-btn.danger:hover { background: var(--ds-danger-bg); }
html[data-ui="v2"] .v2-header button:focus-visible { outline: 2px solid var(--ds-ring); outline-offset: 2px; }
html[data-ui="v2"] .v2-header .last-updated { font-size: 12px; color: var(--ds-muted-foreground); white-space: nowrap; }
html[data-ui="v2"] .v2-header .gas-connection-chip { margin: 0; }
html[data-ui="v2"] .v2-header .current-operator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
  color: var(--ds-muted-foreground);
}
html[data-ui="v2"] .v2-header .current-operator strong { color: var(--ds-foreground); font-size: 13px; }
html[data-ui="v2"] .ops-health-popover { top: calc(var(--v2-header-h) - 4px); } /* v2.js가 칩 위치에 맞춰 top/left를 다시 정한다(칩이 없을 때의 기본값) */

/* 머리글 도구 줄 — 기존 사이드바용 width:100% / 유리 효과를 풀고 한 줄에 맞춘다 */
html[data-ui="v2"] .v2-header__tools > * { flex: 0 0 auto; width: auto; min-width: 0; }
html[data-ui="v2"] .v2-header .gas-connection-chip {
  width: auto; height: 36px; box-sizing: border-box; padding: 0 12px; white-space: nowrap;
  border-radius: 12px; background: var(--ds-card); border-color: var(--ds-border); box-shadow: none; font-size: 12px;
}
html[data-ui="v2"] .v2-header .current-operator {
  width: auto; min-height: 0; padding: 0 4px; border: 0; background: none; box-shadow: none;
  overflow: visible; white-space: nowrap; border-radius: 0;
}
html[data-ui="v2"] .v2-header .current-operator::before,
html[data-ui="v2"] .v2-header .current-operator::after { display: none; }

/* ── 캘린더: 이벤트 타입을 "표시 색상" 오른쪽 팝오버로 (사이드바 섹션은 비움) ───── */
html[data-ui="v2"] .sidebar-section--milestones { display: none; }
html[data-ui="v2"] .v2-cal-types { position: relative; display: inline-flex; }
html[data-ui="v2"] .v2-cal-types__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-card);
  color: var(--ds-card-foreground);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
html[data-ui="v2"] .v2-cal-types__btn:hover { background: var(--ds-muted); }
html[data-ui="v2"] .v2-cal-types__btn[aria-expanded="true"] { border-color: var(--ds-primary); }
html[data-ui="v2"] .v2-cal-types__btn:focus-visible { outline: 2px solid var(--ds-ring); outline-offset: 2px; }
html[data-ui="v2"] .v2-cal-types__count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ds-primary-soft);
  color: var(--ds-primary);
  font-size: 12px;
  font-weight: 700;
}
html[data-ui="v2"] .v2-cal-types__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 300px;
  padding: 12px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-xl);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-card-hover);
}
html[data-ui="v2"] .v2-cal-types__panel[hidden] { display: none; }
html[data-ui="v2"] .v2-cal-types__panel .milestone-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
  max-height: none;
  overflow: visible;
  padding: 0;
  font-size: 13px;
  color: var(--ds-card-foreground);
}
html[data-ui="v2"] .v2-cal-types__panel .milestone-toggles label {
  min-height: 30px;
  color: var(--ds-card-foreground);
}
html[data-ui="v2"] .v2-cal-types__panel .milestone-toggles hr {
  grid-column: 1 / -1;
  margin: 4px 0;
  border-top-color: var(--ds-border);
}

/* 담당자 필터: 사이드바 → 머리글 팝오버. 사이드바의 담당자 라벨은 숨긴다. */
html[data-ui="v2"] .sidebar .nav-label:not(.v2-menu-label) { display: none; }
html[data-ui="v2"] .v2-admin { position: relative; display: inline-flex; }
html[data-ui="v2"] .v2-admin__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-card);
  color: var(--ds-card-foreground);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
html[data-ui="v2"] .v2-admin__btn:hover { background: var(--ds-muted); }
html[data-ui="v2"] .v2-admin__btn[aria-expanded="true"] { border-color: var(--ds-primary); }
html[data-ui="v2"] .v2-admin__btn:focus-visible { outline: 2px solid var(--ds-ring); outline-offset: 2px; }
html[data-ui="v2"] .v2-admin__count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ds-primary-soft);
  color: var(--ds-primary-active);
  font-size: 12px;
  font-weight: 700;
}
html[data-ui="v2"] .v2-admin__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-xl);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-card-hover);
}
html[data-ui="v2"] .v2-admin__panel[hidden] { display: none; }
html[data-ui="v2"] .v2-admin__panel #admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 0; }
html[data-ui="v2"] .v2-admin__panel .nav-item {
  width: 100%;
  min-height: 34px;
  border-radius: var(--ds-radius-md);
  color: var(--ds-card-foreground);
  font-size: 13px;
  box-shadow: none;
}
html[data-ui="v2"] .v2-admin__panel .nav-item:hover { background: var(--ds-muted); }
html[data-ui="v2"] .v2-admin__panel .nav-item.selected,
html[data-ui="v2"] .v2-admin__panel .nav-item.active {
  background: var(--ds-primary-soft);
  color: var(--ds-primary-active);
  font-weight: 700;
  box-shadow: none;
}

/* ── UX 검토 보정(2026-10-14 최종 검토) ───────────────────────────────────── */
/* 1) 키보드 포커스 표시: 운영 전역 토큰(--interactive-focus-ring = 파랑 18%)은 거의 안 보인다(WCAG 2.4.7·1.4.11).
      버전 2에서는 토큰 자체를 로즈 실선 2px로 바꾸고, 어두운 사이드바 위에서는 밝은 로즈로 */
html[data-ui="v2"] { --interactive-focus-ring: var(--ds-ring); }
:root[data-ui="v2"] body :is(button, a[href], [role="button"], [role="tab"], summary, input, select, textarea):focus-visible,
:root[data-ui="v2"] body .gas-connection-chip:focus-visible {
  outline: 2px solid var(--ds-ring);
  outline-offset: 2px;
}
:root[data-ui="v2"] body .sidebar :is(button, a[href], [role="button"]):focus-visible {
  outline: 2px solid #fda4af;
  outline-offset: -2px;
}

/* 2) 머리글 반응형: 좁은 노트북 화면(1366·1280)에서 오른쪽 도구가 제목 폭을 다 먹던 문제.
      제목은 최소 폭을 보장하고, 폭이 모자라면 덜 중요한 것부터 줄인다 */
html[data-ui="v2"] .v2-header__title { flex: 1 1 220px; min-width: 200px; }
html[data-ui="v2"] .v2-header__tools { flex: 0 1 auto; min-width: 0; }
@media (max-width: 1600px) {
  html[data-ui="v2"] .v2-header .last-updated { display: none; }
}
@media (max-width: 1480px) {
  /* 새로고침·상태 점검은 아이콘만(접근 이름은 aria-label로 유지) */
  html[data-ui="v2"] .v2-header .top-health-btn > span:not(.tab-icon),
  html[data-ui="v2"] .v2-header .refresh-btn .refresh-label { display: none; }
  html[data-ui="v2"] .v2-header .top-health-btn,
  html[data-ui="v2"] .v2-header .refresh-btn { width: 36px; padding: 0; }
}
@media (max-width: 1280px) {
  html[data-ui="v2"] .v2-header { padding: 0 16px; gap: 12px; }
  html[data-ui="v2"] .v2-header .current-operator > span { display: none; }
}
@media (max-width: 1120px) {
  html[data-ui="v2"] .v2-header .gas-connection-chip .gas-connection-label { display: none; }
  html[data-ui="v2"] .v2-header .current-operator { display: none; }
}

/* 3) 대비 보정: 칩 안 숫자·보조 글자 */
html[data-ui="v2"] .v2-cal-types__count { color: var(--ds-primary-active); }
html[data-ui="v2"] #view-timetable .tt-label-sub,
html[data-ui="v2"] #view-timetable .tt-extra-chevron { color: var(--ds-muted-foreground); }

/* ── UX 검토 2차 보정(2026-10-14): 심각도 순 잔여 항목 ───────────────────────── */
/* [🟡] 화면 안 제목(h2)이 머리글 제목과 중복 → 숨김. 설명 줄·시트 이름·버튼은 그대로 둔다 */
html[data-ui="v2"] :is(
  #view-attendance .attendance-head h2, #view-documents .document-head h2,
  #view-withdrawals .withdrawal-head h2, #view-trainingCompletion .withdrawal-head h2,
  #view-trainingAnalysis .training-analysis-head h2, #view-allowance .allowance-head h2,
  #view-timetable .tt-card > h2, #view-timetable .tt-head h2, #view-tutorStats .tt-card > h2
) { display: none; }

/* [🟢] 화면 설정(테마 + 글자 크기) 팝오버 — 아이콘만 있던 "가"·달 버튼 대체 */
html[data-ui="v2"] .v2-settings { position: relative; display: inline-flex; }
html[data-ui="v2"] .v2-settings__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-card);
  color: var(--ds-card-foreground);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
html[data-ui="v2"] .v2-settings__btn:hover { background: var(--ds-muted); }
html[data-ui="v2"] .v2-settings__btn[aria-expanded="true"] { border-color: var(--ds-primary); }
html[data-ui="v2"] .v2-settings__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 280px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-xl);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-card-hover);
}
html[data-ui="v2"] .v2-settings__panel[hidden] { display: none; }
html[data-ui="v2"] .v2-settings__title { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--ds-muted-foreground); }
html[data-ui="v2"] .v2-settings__seg { display: flex; width: 100%; box-sizing: border-box; }
html[data-ui="v2"] .v2-settings__seg > button { flex: 1; font-size: 13px; }
html[data-ui="v2"] .v2-settings__seg > button[aria-pressed="true"] {
  background: var(--ds-card);
  color: var(--ds-foreground);
  box-shadow: var(--ds-shadow-card);
}
html[data-ui="v2"][data-theme="dark"] .v2-settings__seg > button[aria-pressed="true"] { box-shadow: none; outline: 1px solid var(--ds-border); }

/* [🟢] 눌러야 하는 작은 것들: 체크박스·라디오 16px, 한 줄 링크/요약 최소 높이 24px(WCAG 2.2 대상 크기) */
html[data-ui="v2"] input[type="checkbox"],
html[data-ui="v2"] input[type="radio"] { width: 16px; height: 16px; accent-color: var(--ds-primary); }
html[data-ui="v2"] :is(.tcsv-sheet-link, #view-guide .guide-content a, .allowance-source-tip, .tt-extra summary, #view-timetable summary) {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

/* [🟢] 대비: 월 밖 날짜(옅은 슬레이트 → 보조 글자색), 본문 위 보조 글자는 4.5:1 이상 */
html[data-ui="v2"] #view-trainingAnalysis .training-calendar-cell.is-out,
html[data-ui="v2"] #view-trainingAnalysis .training-calendar-cell.is-out .training-calendar-date { color: var(--ds-muted-foreground); }
html[data-ui="v2"] #view-calendar :is(.cal-color-legend-empty, .cal-empty),
html[data-ui="v2"] #view-tasks .board-empty { color: var(--ds-muted-foreground); }

@media (max-width: 1480px) {
  html[data-ui="v2"] .v2-settings__label { display: none; }
  html[data-ui="v2"] .v2-settings__btn { width: 36px; padding: 0; justify-content: center; }
}

/* [🟢] 대비 2차: 링크·정보 글자는 전용 토큰(라이트 진한 파랑 / 다크 연한 파랑), D-day 주황·노랑 글자는 같은 색상군의 진한 톤 */
html[data-ui="v2"] { --ds-info-fg: #1d4ed8; }
html[data-ui="v2"][data-theme="dark"] { --ds-info-fg: #93c5fd; }
html[data-ui="v2"]:not([data-theme="dark"]) :is(.csv-due-urgent, .orsv-due-urgent, .crsv-due-urgent) { color: #c2410c; }
html[data-ui="v2"]:not([data-theme="dark"]) :is(.csv-due-caution, .orsv-due-caution, .crsv-due-caution) { color: #b45309; }
html[data-ui="v2"] #view-contract .contract-sc-count { color: var(--ds-card-foreground); }
html[data-ui="v2"] #view-tasks .board-empty { opacity: 1; }
html[data-ui="v2"]:not([data-theme="dark"]) #view-timetable .tt-help-no { color: #b91c1c; }
html[data-ui="v2"] #view-timetable :is(.tt-extra-opt-badge, .tt-input-icon) { color: var(--ds-muted-foreground); }
html[data-ui="v2"]:not([data-theme="dark"]) #view-documents :is(.dsv-item-type-chip, .dsv-detail-chip) { color: var(--ds-info-fg); }

/* [🟢] 분석 화면 React 패널(--rc-*, 시안 색 H S% L% 형식)을 LMS 값에 연결 — 카드 안 카드 색 불일치·파랑 포커스 제거.
   --rc-* 이름만 쓴다(DR-044: LMS 원래 이름 --primary 등은 충돌 위험)
   라이트 선택자에 :not([data-theme="dark"])를 둔 이유: React 번들의 :root[data-theme="light"](명시도 0,2,0)가
   html[data-ui="v2"](0,1,1)보다 강해서, 라이트를 명시한 상태(v2.js는 항상 명시)에선 이 연결이 통째로 무시됐다.
   (0,2,1)로 올려 이긴다 — 다크는 [data-theme="dark"]가 붙어 이미 0,2,1. */
html[data-ui="v2"]:not([data-theme="dark"]) {
  --rc-background: 210 40% 98%;
  --rc-foreground: 222.2 47.4% 11.2%;
  --rc-card: 0 0% 100%;
  --rc-card-foreground: 217.2 32.6% 17.5%;
  --rc-border: 214.3 31.8% 91.4%;
  --rc-muted: 210 40% 96.1%;
  --rc-muted-foreground: 215 18.7% 40.6%;
  --rc-ring: 349.7 89.2% 60.2%;
  --rc-primary: 349.7 89.2% 60.2%;
  --rc-primary-foreground: 0 0% 100%;
}
html[data-ui="v2"][data-theme="dark"] {
  --rc-background: 222.2 47.4% 11.2%;
  --rc-foreground: 210 40% 96.1%;
  --rc-card: 217.2 32.6% 17.5%;
  --rc-card-foreground: 214.3 31.8% 91.4%;
  --rc-border: 215.3 25% 26.7%;
  --rc-muted: 215.3 25% 26.7%;
  --rc-muted-foreground: 216 21.4% 72.5%;
  --rc-ring: 351.3 94.5% 71.2%;
  --rc-primary: 351.3 94.5% 71.2%;
  --rc-primary-foreground: 348.7 72.6% 14.3%;
}
/* 오류 안내 글자(라이트): 위험 빨강의 진한 톤 */
/* 앱이 이 오류 문구 색을 인라인(color:var(--urgent))으로 지정해서 !important가 필요하다(이 한 곳만, 라이트 한정) */
html[data-ui="v2"]:not([data-theme="dark"]) #view-tasks .board-empty { color: #b91c1c !important; }

/* [🟢] 다크 대비 마무리: 분석 패널의 위험 빨강(글자·배지)과 몇 곳의 빨강/주황 글자를 다크 카드 위 4.5:1 이상으로 */
html[data-ui="v2"][data-theme="dark"] {
  --rc-destructive: 0 91% 71%;
  --rc-destructive-foreground: 0 0% 9%;
}
html[data-ui="v2"][data-theme="dark"] #view-timetable .tt-help-no { color: #fca5a5; }
html[data-ui="v2"][data-theme="dark"] :is(.csv-due-urgent, .orsv-due-urgent, .crsv-due-urgent) { color: #fb923c; }
html[data-ui="v2"][data-theme="dark"] #view-timetable .tt-help-no { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
html[data-ui="v2"] #view-trainingAnalysis .training-calendar-panel span:not([class]),
html[data-ui="v2"] #view-allowance p:not([class]) { color: var(--ds-muted-foreground); }

/* 이벤트 타입 목록이 열려 있는 동안엔 "표시 색상" 안내(마우스 올리면 뜸)를 가려 두 팝업이 겹치지 않게 */
html[data-ui="v2"] #view-calendar:has(.v2-cal-types__panel:not([hidden])) .cal-color-legend {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── 연결 상태 칩 + 상태 점검 합치기(사용자 제안 2026-10-15) ─────────────────────
   "시트 연결됨" 칩이 곧 상태 점검 버튼이다. 별도 버튼(#ops-health-btn)은 app.js가 상태를 관리하므로 DOM에 두고 눈에만 숨긴다. */
:root[data-ui="v2"] body .v2-header .v2-health-merged { display: none; }
html[data-ui="v2"] .v2-chip-health { cursor: pointer; gap: 8px; }
html[data-ui="v2"] .v2-chip-health:hover { filter: brightness(0.97); }
/* 칩 오른쪽의 "상태 점검 ▾" — 누르면 점검 패널이 열린다는 단서. 문제가 있으면 글자가 바뀐다 */
html[data-ui="v2"] .v2-chip-health::after {
  content: "상태 점검 \25BE";
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid currentColor;
  font-weight: 500;
  opacity: 0.75;
}
html[data-ui="v2"] .v2-chip-health[aria-expanded="true"]::after { content: "상태 점검 \25B4"; }
html[data-ui="v2"] .v2-chip-health[data-health="warn"]::after { content: "점검 필요 \25BE"; opacity: 1; font-weight: 700; }
html[data-ui="v2"] .v2-chip-health[data-health="fail"]::after { content: "문제 있음 \25BE"; opacity: 1; font-weight: 700; }
html[data-ui="v2"] .v2-chip-health[data-health-busy="1"]::after { content: "점검 중…"; opacity: 1; }
html[data-ui="v2"]:not([data-theme="dark"]) .v2-chip-health[data-health="warn"]::after { color: #b45309; }
html[data-ui="v2"]:not([data-theme="dark"]) .v2-chip-health[data-health="fail"]::after { color: #b91c1c; }
html[data-ui="v2"][data-theme="dark"] .v2-chip-health[data-health="warn"]::after { color: var(--ds-warning); }
html[data-ui="v2"][data-theme="dark"] .v2-chip-health[data-health="fail"]::after { color: #fca5a5; }
@media (max-width: 1280px) {
  html[data-ui="v2"] .v2-chip-health::after { content: "\25BE"; padding-left: 8px; }
  html[data-ui="v2"] .v2-chip-health[aria-expanded="true"]::after { content: "\25B4"; }
  html[data-ui="v2"] .v2-chip-health[data-health="warn"]::after { content: "점검 필요 \25BE"; }
  html[data-ui="v2"] .v2-chip-health[data-health="fail"]::after { content: "문제 있음 \25BE"; }
  html[data-ui="v2"] .v2-chip-health[data-health-busy="1"]::after { content: "점검 중…"; }
}
