/* ==========================================
 * InsureMate — Global Dark Mode Override
 * 목적: 페이지가 토큰을 우회하고 색상을 하드코딩한 영역까지 다크로 강제 swap.
 *       iOS 시스템 다크모드 톤 (systemBackground/systemGray6/systemGray5).
 *
 * 안전: 모든 셀렉터를 [data-theme="dark"] 스코프에 격리 → 라이트 회귀 0%.
 * !important: 인라인 style="..." 우회 + 인쇄 가드 케이스에만 한정.
 * 의존: css/mateworks-base.css 다크 토큰 (--mw-paper, --mw-white, --mw-text-1, --mw-border)
 *
 * cascade 의존이라 페이지 head의 마지막 stylesheet 위치에 link 권장.
 * ========================================== */

/* ① color-scheme — 네이티브 위젯 자동 swap (스크롤바·input[type=date]·체크박스·select dropdown) */
:root[data-theme="dark"] { color-scheme: dark; }
:root:not([data-theme="dark"]) { color-scheme: light; }

/* ② body / html 베이스 강제 — 페이지가 body{background:#FAFAFA}로 박아둔 경우 우회 */
[data-theme="dark"] html,
[data-theme="dark"] body {
    background: var(--mw-paper, #000) !important;
    color: var(--mw-text-1, #EBEBF5);
}

/* ③ 인라인 style="background:..." 캐치 (변형) */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:#FFF"],
[data-theme="dark"] [style*="background: #FFF"],
[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:#FAFAFA"],
[data-theme="dark"] [style*="background: #FAFAFA"],
[data-theme="dark"] [style*="background:#fafafa"],
[data-theme="dark"] [style*="background: #fafafa"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background-color:white"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background:#F8FAFC"],
[data-theme="dark"] [style*="background: #F8FAFC"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#F1F5F9"],
[data-theme="dark"] [style*="background: #F1F5F9"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background:#FAFBFC"],
[data-theme="dark"] [style*="background: #FAFBFC"],
[data-theme="dark"] [style*="background:#fafbfc"],
[data-theme="dark"] [style*="background: #fafbfc"],
[data-theme="dark"] [style*="background-color:#F8FAFC"],
[data-theme="dark"] [style*="background-color: #F8FAFC"],
[data-theme="dark"] [style*="background-color:#f8fafc"],
[data-theme="dark"] [style*="background-color: #f8fafc"],
[data-theme="dark"] [style*="background-color:#F1F5F9"],
[data-theme="dark"] [style*="background-color:#f1f5f9"] {
    background: var(--mw-white, #1C1C1E) !important;
}

/* ④ 인라인 style="color:..." 캐치 — 본문/제목 흑색·짙은 다크 텍스트
   중간톤(#475569·#374151·#64748b)은 의도적으로 제외 — 라벨/보조 텍스트 위계 보존. */
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color:#0F172A"],
[data-theme="dark"] [style*="color: #0F172A"],
[data-theme="dark"] [style*="color:#141414"],
[data-theme="dark"] [style*="color: #141414"],
[data-theme="dark"] [style*="color:#000"],
[data-theme="dark"] [style*="color: #000"],
[data-theme="dark"] [style*="color:black"],
[data-theme="dark"] [style*="color: black"],
[data-theme="dark"] [style*="color:#1B1B1B"],
[data-theme="dark"] [style*="color: #1B1B1B"],
[data-theme="dark"] [style*="color:#1b1b1b"],
[data-theme="dark"] [style*="color: #1b1b1b"],
[data-theme="dark"] [style*="color:#1E293B"],
[data-theme="dark"] [style*="color: #1E293B"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color:#1F2937"],
[data-theme="dark"] [style*="color: #1F2937"],
[data-theme="dark"] [style*="color:#1f2937"],
[data-theme="dark"] [style*="color: #1f2937"],
[data-theme="dark"] [style*="color:#1a1a1a"],
[data-theme="dark"] [style*="color: #1a1a1a"],
[data-theme="dark"] [style*="color:#1A1A1A"],
[data-theme="dark"] [style*="color: #1A1A1A"],
[data-theme="dark"] [style*="color:#212121"],
[data-theme="dark"] [style*="color: #212121"],
[data-theme="dark"] [style*="color:#27272a"],
[data-theme="dark"] [style*="color: #27272a"],
[data-theme="dark"] [style*="color:#18181b"],
[data-theme="dark"] [style*="color: #18181b"] {
    color: var(--mw-text-1, #EBEBF5) !important;
}

/* ⑤ 공통 컴포넌트 클래스 — 카드/모달/팝오버/드롭다운/PopupShell/대시보드 위젯/토스트 */
[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] .modal,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .popover,
[data-theme="dark"] .popup,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .cust-popup,
[data-theme="dark"] .dash-reminder-toast,
[data-theme="dark"] .ps-card,
[data-theme="dark"] .ps-head,
[data-theme="dark"] .ps-preview,
[data-theme="dark"] .ps-btn-secondary,
[data-theme="dark"] .meeting-result-toast,
[data-theme="dark"] .gs-action,
[data-theme="dark"] .gs-edit-bar,
[data-theme="dark"] .gs-picker,
[data-theme="dark"] .gs-picker-card,
[data-theme="dark"] .todo-detail-card {
    background: var(--mw-white, #1C1C1E);
    color: var(--mw-text-1, #EBEBF5);
    border-color: var(--mw-border, rgba(255,255,255,.08));
}

/* ⑤-a 컴포넌트 텍스트 색상 (배경은 부모가 처리) */
[data-theme="dark"] .ps-head-action,
[data-theme="dark"] .ps-head-name,
[data-theme="dark"] .ps-pv-textarea,
[data-theme="dark"] .gs-widget-hd,
[data-theme="dark"] .gs-title,
[data-theme="dark"] .ps-head-help b,
[data-theme="dark"] .memo-sticky textarea {
    color: var(--mw-text-1, #EBEBF5);
}

/* ⑤-b hover 상태 — 라이트는 #FAFAFA / #f1f5f9 / #EEF0FF로 바뀌지만 다크에서는 surface-alt */
[data-theme="dark"] .ps-btn-secondary:hover,
[data-theme="dark"] .ps-btn-cancel:hover,
[data-theme="dark"] .gs-picker-card:hover {
    background: var(--mw-surface-alt, #2C2C2E);
}

/* ⑤-c 보조 토글/스누즈 버튼 — 라이트 회색 칩이 다크에서 흰판이 안 되도록 */
[data-theme="dark"] .dr-btn-snooze {
    background: var(--mw-surface-alt, #2C2C2E);
    color: var(--mw-text-2, rgba(235,235,245,.6));
}

/* ⑥ 폼 컨트롤 — input/textarea/select. 체크박스·라디오·range는 color-scheme이 처리 */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--mw-surface-alt, #2C2C2E);
    color: var(--mw-text-1, #EBEBF5);
    border-color: var(--mw-border, rgba(255,255,255,.08));
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--mw-text-3, rgba(235,235,245,.30));
}

/* ⑦ 표 — th/td/zebra/hover */
[data-theme="dark"] table {
    background: transparent;
    color: var(--mw-text-1, #EBEBF5);
}
[data-theme="dark"] thead th,
[data-theme="dark"] th {
    background: var(--mw-surface-alt, #2C2C2E);
    border-color: var(--mw-border, rgba(255,255,255,.08));
    color: var(--mw-text-1, #EBEBF5);
}
[data-theme="dark"] tbody td,
[data-theme="dark"] td {
    border-color: var(--mw-border, rgba(255,255,255,.08));
}
[data-theme="dark"] tbody tr:hover td {
    background: rgba(255,255,255,.03);
}

/* ⑧ 그림자 → 보더로 elevation 치환 (iOS 다크는 그림자 거의 안 보임) */
[data-theme="dark"] .card,
[data-theme="dark"] .modal,
[data-theme="dark"] .popup,
[data-theme="dark"] .cust-popup,
[data-theme="dark"] .dash-reminder-toast,
[data-theme="dark"] .ps-card,
[data-theme="dark"] .meeting-result-toast,
[data-theme="dark"] .todo-detail-card {
    box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 0 0 1px rgba(255,255,255,.06) !important;
}

/* ⑨ 모달 오버레이 — iOS 다크 글래스 (인라인 rgba 캐치) */
[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] [style*="background:rgba(0,0,0,.3)"],
[data-theme="dark"] [style*="background:rgba(0,0,0,.4)"],
[data-theme="dark"] [style*="background:rgba(0,0,0,.5)"],
[data-theme="dark"] [style*="background: rgba(0,0,0,.5)"] {
    background: rgba(0,0,0,.72) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* ⑩ SVG fill="#000" / "black" 보정. currentColor·fill="none"은 자동 처리됨 */
[data-theme="dark"] svg [fill="#000"],
[data-theme="dark"] svg [fill="#000000"],
[data-theme="dark"] svg [fill="black"] {
    fill: var(--mw-text-1, #EBEBF5);
}
[data-theme="dark"] svg [stroke="#000"],
[data-theme="dark"] svg [stroke="#000000"],
[data-theme="dark"] svg [stroke="black"] {
    stroke: var(--mw-text-1, #EBEBF5);
}

/* ⑪ 네이티브 스크롤바 — WebKit (Chrome/Edge/Safari) */
[data-theme="dark"] *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.18);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.28);
    background-clip: padding-box;
    border: 2px solid transparent;
}
[data-theme="dark"] *::-webkit-scrollbar-track {
    background: transparent;
}
[data-theme="dark"] *::-webkit-scrollbar-corner {
    background: transparent;
}

/* ⑫ 인쇄 가드 — 다크 상태에서 Ctrl+P 시 강제 라이트 (토너 절약 + 가독성) */
@media print {
    :root[data-theme="dark"] {
        color-scheme: light !important;
        --mw-paper: #fff !important;
        --mw-white: #fff !important;
        --mw-cream: #fff !important;
        --mw-surface-alt: #f4f4f5 !important;
        --mw-text-1: #141414 !important;
        --mw-text-2: #71717a !important;
        --mw-text-3: #a1a1aa !important;
        --mw-border: #e4e4e7 !important;
        --mw-border-strong: #d4d4d8 !important;
    }
    [data-theme="dark"] html,
    [data-theme="dark"] body {
        background: #fff !important;
        color: #141414 !important;
    }
    [data-theme="dark"] *,
    [data-theme="dark"] *::before,
    [data-theme="dark"] *::after {
        background: transparent !important;
        color: #141414 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* ⑬ Tailwind utility 다크 오버라이드 — dashboard.js 리마인더/태스크 카드용
   원본 라이트 톤(`bg-pink-50` 등)은 라이트 핑크/오렌지 등 파스텔로, 다크 배경에서 흰판이 됨.
   12% 알파로 색조는 유지하되 다크 배경과 자연스럽게 합성. !important는 Tailwind utility 우선순위 회피. */
[data-theme="dark"] .bg-pink-50    { background: rgba(236, 72, 153, .12) !important; }
[data-theme="dark"] .bg-red-50     { background: rgba(220, 38, 38, .12) !important; }
[data-theme="dark"] .bg-orange-50  { background: rgba(234, 88, 12, .12) !important; }
[data-theme="dark"] .bg-blue-50    { background: rgba(59, 130, 246, .12) !important; }
[data-theme="dark"] .bg-green-50   { background: rgba(16, 185, 129, .12) !important; }
[data-theme="dark"] .bg-yellow-50  { background: rgba(234, 179, 8, .12) !important; }
[data-theme="dark"] .bg-amber-50   { background: rgba(245, 158, 11, .12) !important; }
[data-theme="dark"] .bg-purple-50  { background: rgba(168, 85, 247, .12) !important; }
[data-theme="dark"] .bg-indigo-50  { background: rgba(99, 102, 241, .12) !important; }
[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] .bg-gray-50    { background: var(--mw-surface-alt, #2C2C2E) !important; }
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-zinc-900,
[data-theme="dark"] .text-neutral-900 { color: var(--mw-text-1, #EBEBF5) !important; }
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-slate-800   { color: var(--mw-text-1, #EBEBF5) !important; }

/* ⑭ 인라인 보더 hex swap — 라이트 회색 보더(`#e4e4e7` 등)가 다크에서 도드라지는 케이스
   다크 토큰 `rgba(255,255,255,.08)`로 swap. border-color는 컴포넌트 미세조정용이라 라이트 회귀 0. */
[data-theme="dark"] [style*="border:1px solid #e4e4e7"],
[data-theme="dark"] [style*="border: 1px solid #e4e4e7"],
[data-theme="dark"] [style*="border:1px solid #E4E4E7"],
[data-theme="dark"] [style*="border: 1px solid #E4E4E7"],
[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border:1px solid #E2E8F0"],
[data-theme="dark"] [style*="border: 1px solid #E2E8F0"],
[data-theme="dark"] [style*="border:1px solid #d1d5db"],
[data-theme="dark"] [style*="border: 1px solid #d1d5db"],
[data-theme="dark"] [style*="border:1px solid #D1D5DB"],
[data-theme="dark"] [style*="border: 1px solid #D1D5DB"],
[data-theme="dark"] [style*="border:1px solid #cbd5e1"],
[data-theme="dark"] [style*="border: 1px solid #cbd5e1"],
[data-theme="dark"] [style*="border:1px solid #f3f4f6"],
[data-theme="dark"] [style*="border: 1px solid #f3f4f6"],
[data-theme="dark"] [style*="border:1px solid #EBEBEB"],
[data-theme="dark"] [style*="border: 1px solid #EBEBEB"],
[data-theme="dark"] [style*="border:2px solid #e4e4e7"],
[data-theme="dark"] [style*="border:2px solid #fde68a"],
[data-theme="dark"] [style*="border:2px solid #a7f3d0"],
[data-theme="dark"] [style*="border-color:#e4e4e7"],
[data-theme="dark"] [style*="border-color: #e4e4e7"],
[data-theme="dark"] [style*="border-color:#e2e8f0"],
[data-theme="dark"] [style*="border-color: #e2e8f0"],
[data-theme="dark"] [style*="border-color:#d1d5db"],
[data-theme="dark"] [style*="border-color: #d1d5db"] {
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}

/* ⑮ 페이지 로컬 토큰 오버라이드 + 다크 텍스트 스케일 재정의
   사용자 요청 (2026-05-03): 순백 → 무채색 그레이 #D4D4D4 (채도 0, 명도 두 톤 ↓, 대비 12.5:1 AAA). */
:root[data-theme="dark"] {
    /* 다크 텍스트 스케일 — 강제 재매핑 (mw-* 토큰 자체 swap) */
    --mw-text-1: #D4D4D4;                  /* 본문/제목: 무채색 그레이 (눈 자극 ↓) */
    --mw-text-2: rgba(212,212,212,.62);    /* 보조: 동일 계열 62% */
    --mw-text-3: rgba(212,212,212,.38);    /* 희미: 동일 계열 38% */
    /* 페이지 로컬 토큰 swap */
    --text-primary: #D4D4D4;
    --text-secondary: rgba(212,212,212,.62);
    --text-muted: rgba(212,212,212,.38);
    --text: #D4D4D4;
    --sub: rgba(212,212,212,.62);
    --muted: rgba(212,212,212,.38);
    --bg-primary: var(--mw-paper, #000);
    --surface-white: var(--mw-white, #1C1C1E);
    --surface-light: var(--mw-surface-alt, #2C2C2E);
    --border-light: var(--mw-border, rgba(255,255,255,.08));
    --border-input: var(--mw-border-strong, rgba(255,255,255,.16));
    --accent-blue-bg: rgba(59,130,246,.18);
    --warning-bg: rgba(245,158,11,.15);
    --error-bg: rgba(220,38,38,.15);
    --success-bg: rgba(74,222,128,.15);
    /* tools/* + customer/crm/admin 페이지에 흔한 별칭 — 2026-05-10 추가 (Phase A.4) */
    --bg: var(--mw-paper, #000);
    --bg-secondary: var(--mw-white, #1C1C1E);
    --card: var(--mw-white, #1C1C1E);
    --surface: var(--mw-white, #1C1C1E);
    --surface-alt: var(--mw-surface-alt, #2C2C2E);
    --text-1: #D4D4D4;
    --text-2: rgba(212,212,212,.62);
    --text-3: rgba(212,212,212,.38);
    --text2: rgba(212,212,212,.62);
    --text3: rgba(212,212,212,.38);
    --border: var(--mw-border, rgba(255,255,255,.08));
    --border-color: var(--mw-border, rgba(255,255,255,.08));
    --border-strong: var(--mw-border-strong, rgba(255,255,255,.16));
    --accent-light: var(--mw-surface-alt, #2C2C2E);
    --pl: rgba(255,255,255,.08);                  /* dashboard --pl primary-light */
    --blue-bg: rgba(59,130,246,.18);
    --blue-light: rgba(59,130,246,.12);
    --green-bg: rgba(74,222,128,.15);
    --yellow-bg: rgba(245,158,11,.15);
    --red-bg: rgba(220,38,38,.15);
    /* Twenty CRM 별칭 (crm-twenty.html, twenty-tokens.css) */
    --tw-bg: var(--mw-paper, #000);
    --tw-surface: var(--mw-white, #1C1C1E);
    --tw-surface-alt: var(--mw-surface-alt, #2C2C2E);
    --tw-text-1: #D4D4D4;
    --tw-text-2: rgba(212,212,212,.62);
    --tw-text-3: rgba(212,212,212,.38);
    --tw-border: var(--mw-border, rgba(255,255,255,.08));
    --tw-border-strong: var(--mw-border-strong, rgba(255,255,255,.16));
    --tw-row-hover: rgba(255,255,255,.06);
    --tw-shell-bg: #1B1B1B;
    /* 사이드바 토큰 (admin.html, customer.html에 노출) */
    --sb-bg: var(--mw-white, #1C1C1E);
    --sb-hover: var(--mw-surface-alt, #2C2C2E);
    --sb-text: rgba(212,212,212,.62);
    --sb-text-muted: rgba(212,212,212,.38);
}

/* ⑯ 주간일정/스케줄 컴포넌트 텍스트 보강 — color 직결 셀렉터 명시 강제 */
[data-theme="dark"] .schedule-header .header-title,
[data-theme="dark"] .schedule-header .date-label,
[data-theme="dark"] .schedule-header .date-nav button,
[data-theme="dark"] th,
[data-theme="dark"] td:first-child,
[data-theme="dark"] .cell-add-btn,
[data-theme="dark"] .event-card .event-name,
[data-theme="dark"] .event-card .event-time,
[data-theme="dark"] .event-card .event-type,
[data-theme="dark"] .event-card .event-location,
[data-theme="dark"] .tl-card .top .time,
[data-theme="dark"] .tl-card .ta-stat,
[data-theme="dark"] .tl-card .ta-stat b,
[data-theme="dark"] .tl-card .ta-stat input,
[data-theme="dark"] .tl-col-head .date,
[data-theme="dark"] .tl-col-head .day,
[data-theme="dark"] .tl-col-foot,
[data-theme="dark"] .tl-col-foot b,
[data-theme="dark"] .tl-day .num,
[data-theme="dark"] .tl-menu button,
[data-theme="dark"] .monthly-cell .month-date,
[data-theme="dark"] .stats-bar .stat-label,
[data-theme="dark"] .stats-bar .stat-value,
[data-theme="dark"] .goal-strip .goal-label,
[data-theme="dark"] .goal-strip .goal-value,
[data-theme="dark"] .empty-week,
[data-theme="dark"] .empty-week .empty-text,
[data-theme="dark"] .crm-popover {
    color: var(--mw-text-1, #EBEBF5);
}
[data-theme="dark"] .tl-card .meta,
[data-theme="dark"] .tl-card .top,
[data-theme="dark"] .timeline-time,
[data-theme="dark"] .header-icon-label {
    color: var(--mw-text-2, rgba(235,235,245,.65));
}

/* ⑰ Tailwind 중간 톤 (700~400) + .text-black — §⑬에서 900/800만 처리됨 */
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-zinc-700,
[data-theme="dark"] .text-neutral-700 { color: var(--mw-text-1, #EBEBF5) !important; }
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-zinc-600,
[data-theme="dark"] .text-neutral-600 { color: var(--mw-text-2, rgba(235,235,245,.65)) !important; }
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-slate-500,
[data-theme="dark"] .text-zinc-500,
[data-theme="dark"] .text-neutral-500 { color: var(--mw-text-2, rgba(235,235,245,.55)) !important; }
[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-zinc-400 { color: var(--mw-text-3, rgba(235,235,245,.40)) !important; }
[data-theme="dark"] .text-black { color: var(--mw-text-1, #EBEBF5) !important; }

/* ⑱ FontAwesome 아이콘 가드 — 부모 다크 색 상속 명시. 컬러 클래스(.text-blue-500 등) 보존. */
[data-theme="dark"] i.fa,
[data-theme="dark"] i.fas, [data-theme="dark"] i.far, [data-theme="dark"] i.fal, [data-theme="dark"] i.fab,
[data-theme="dark"] i.fa-solid, [data-theme="dark"] i.fa-regular, [data-theme="dark"] i.fa-light, [data-theme="dark"] i.fa-brands {
    color: inherit;
}

/* ⑲ 팝업/모달 본문 텍스트 — 배경은 §⑤. 자체 컬러 클래스 가진 자식(.tag/.badge/링크/.result)은 자체 specificity로 살아남음. */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .popover,
[data-theme="dark"] .popup,
[data-theme="dark"] .cust-popup,
[data-theme="dark"] .modal,
[data-theme="dark"] .ps-card,
[data-theme="dark"] .todo-detail-card,
[data-theme="dark"] .dash-reminder-toast,
[data-theme="dark"] .meeting-result-toast {
    color: var(--mw-text-1, #EBEBF5);
}
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .modal-body label,
[data-theme="dark"] .modal-body p,
[data-theme="dark"] .popup p,
[data-theme="dark"] .popup span:not([class]),
[data-theme="dark"] .cust-popup p,
[data-theme="dark"] .cust-popup span:not([class]) {
    color: var(--mw-text-1, #EBEBF5);
}

/* ⑳ 대시보드 위젯 specificity 보강 + 인라인 중간톤 텍스트 swap
   원인: dashboard-final.html 의 inline <style>이 dark-mode.css link보다 뒤에서 정의돼
   같은 specificity 시 cascade 순서로 인라인이 이김 → 다크에서도 #141414 검정 그대로 보임.
   해결: 부모 셀렉터 추가해 specificity 한 단계 높임. 인라인 76개+ #52525b 중간톤 catch-all. */
[data-theme="dark"] .gs-widget,
[data-theme="dark"] .gs-widget-bd,
[data-theme="dark"] .gs-widget-hd,
[data-theme="dark"] .gs-widget-hd .gs-title,
[data-theme="dark"] .gs-widget .gs-title,
[data-theme="dark"] .gw-sched-wrap,
[data-theme="dark"] .gw-sched-toolbar,
[data-theme="dark"] .gw-sched-bd-stack,
[data-theme="dark"] .gw-empty,
[data-theme="dark"] .gw-todo-tabs,
[data-theme="dark"] .gw-todo-tab,
[data-theme="dark"] .gw-todo-list,
[data-theme="dark"] .gw-memo,
[data-theme="dark"] .ins-card,
[data-theme="dark"] .ins-num,
[data-theme="dark"] .ins-lbl,
[data-theme="dark"] .ins-names,
[data-theme="dark"] .cp-section,
[data-theme="dark"] .cp-section-title,
[data-theme="dark"] .memo-box,
[data-theme="dark"] .memo-box h3,
[data-theme="dark"] .memo-ov .memo-box {
    color: #D4D4D4 !important;
}
[data-theme="dark"] .ins-sub,
[data-theme="dark"] .gw-sched-toolbar button,
[data-theme="dark"] .gs-widget-hd .gs-action,
[data-theme="dark"] .week-lbl,
[data-theme="dark"] .header-icon-label,
[data-theme="dark"] .gw-todo-tab:not(.active) {
    color: rgba(212,212,212,.62) !important;
}

/* §⑳-b 위젯 textarea/input — dashboard.js inline style="background:#FFFCEB;color:#141414" 강제 swap */
[data-theme="dark"] .gs-widget-bd textarea,
[data-theme="dark"] .gs-widget-bd input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
[data-theme="dark"] .gw-memo textarea,
[data-theme="dark"] .memo-sticky textarea {
    color: #D4D4D4 !important;
    background: var(--mw-surface-alt, #2C2C2E) !important;
}
[data-theme="dark"] .gs-widget-bd textarea::placeholder,
[data-theme="dark"] .gw-memo textarea::placeholder,
[data-theme="dark"] .memo-sticky textarea::placeholder {
    color: rgba(212,212,212,.38) !important;
}

/* 인라인 중간/짙은 회색 텍스트 — dashboard.js 76개+ 케이스. §④ catch-all 확장. */
[data-theme="dark"] [style*="color:#52525b"],
[data-theme="dark"] [style*="color: #52525b"],
[data-theme="dark"] [style*="color:#52525B"],
[data-theme="dark"] [style*="color: #52525B"],
[data-theme="dark"] [style*="color:#71717a"],
[data-theme="dark"] [style*="color: #71717a"],
[data-theme="dark"] [style*="color:#71717A"],
[data-theme="dark"] [style*="color: #71717A"],
[data-theme="dark"] [style*="color:#374151"],
[data-theme="dark"] [style*="color: #374151"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#4b5563"],
[data-theme="dark"] [style*="color: #4b5563"],
[data-theme="dark"] [style*="color:#4B5563"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"],
[data-theme="dark"] [style*="color:#64748B"],
[data-theme="dark"] [style*="color:#3f3f46"],
[data-theme="dark"] [style*="color: #3f3f46"],
[data-theme="dark"] [style*="color:#27272a"],
[data-theme="dark"] [style*="color: #27272a"],
[data-theme="dark"] [style*="color:#3b3b3b"],
[data-theme="dark"] [style*="color: #3b3b3b"] {
    color: var(--mw-text-2, rgba(235,235,245,.65)) !important;
}
[data-theme="dark"] [style*="color:#a1a1aa"],
[data-theme="dark"] [style*="color: #a1a1aa"],
[data-theme="dark"] [style*="color:#A1A1AA"],
[data-theme="dark"] [style*="color:#9ca3af"],
[data-theme="dark"] [style*="color: #9ca3af"],
[data-theme="dark"] [style*="color:#94a3b8"],
[data-theme="dark"] [style*="color: #94a3b8"],
[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color: #999"],
[data-theme="dark"] [style*="color:#888"],
[data-theme="dark"] [style*="color: #888"] {
    color: rgba(212,212,212,.38) !important;
}

/* §⑳-c 인라인 노란/아이보리 라이트 배경 — 메모 textarea/스티커 등 */
[data-theme="dark"] [style*="background:#FFFCEB"],
[data-theme="dark"] [style*="background: #FFFCEB"],
[data-theme="dark"] [style*="background:#FFF9C4"],
[data-theme="dark"] [style*="background: #FFF9C4"],
[data-theme="dark"] [style*="background-color:#FFFCEB"],
[data-theme="dark"] [style*="background-color: #FFFCEB"] {
    background: var(--mw-surface-alt, #2C2C2E) !important;
}

/* §⑳-d 검정 인라인 텍스트 → 순수 화이트 강제 (사용자 요청 2026-04-30)
   §④에서 처리되지만 인라인 specificity 0,1,0 vs 0,1,0 cascade 동률 방지를 위해 !important. */
[data-theme="dark"] [style*="color:#141414"],
[data-theme="dark"] [style*="color: #141414"],
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color:#0F172A"],
[data-theme="dark"] [style*="color: #0F172A"],
[data-theme="dark"] [style*="color:#1B1B1B"],
[data-theme="dark"] [style*="color: #1B1B1B"],
[data-theme="dark"] [style*="color:#1b1b1b"],
[data-theme="dark"] [style*="color: #1b1b1b"],
[data-theme="dark"] [style*="color:#000"],
[data-theme="dark"] [style*="color: #000"],
[data-theme="dark"] [style*="color:black"],
[data-theme="dark"] [style*="color: black"],
[data-theme="dark"] [style*="color:#1E293B"],
[data-theme="dark"] [style*="color: #1E293B"],
[data-theme="dark"] [style*="color:#1F2937"],
[data-theme="dark"] [style*="color: #1F2937"],
[data-theme="dark"] [style*="color:#1A1A1A"],
[data-theme="dark"] [style*="color:#1a1a1a"],
[data-theme="dark"] [style*="color:#212121"] {
    color: #D4D4D4 !important;
}

/* ㉑ 토스트 — 사용자 요청 (2026-04-30)
   3종: .dash-reminder-toast, .meeting-result-toast, .todo-reminder-toast.
   stylesheet에 hex 직박 (인라인 아님) → §④/§⑳-d 인라인 catch 안 잡힘. 명시 강제. */
[data-theme="dark"] .todo-reminder-toast {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: rgba(245,158,11,.35) !important;
    color: #D4D4D4 !important;
    box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) !important;
}
[data-theme="dark"] .meeting-result-toast {
    border-color: rgba(74,222,128,.35) !important;
}
[data-theme="dark"] .dash-reminder-toast {
    border-color: rgba(245,158,11,.35) !important;
}
/* 토스트 제목 — 라이트 #1e293b → 화이트 */
[data-theme="dark"] .dash-reminder-toast .dr-title,
[data-theme="dark"] .meeting-result-toast .mr-title,
[data-theme="dark"] .todo-reminder-toast .toast-title {
    color: #D4D4D4 !important;
}
/* 토스트 본문 — 라이트 #334155/#475569 → 아이보리 */
[data-theme="dark"] .dash-reminder-toast .dr-text,
[data-theme="dark"] .todo-reminder-toast .toast-text,
[data-theme="dark"] .meeting-result-toast .mr-text,
[data-theme="dark"] .meeting-result-toast .mr-body {
    color: rgba(212,212,212,.62) !important;
}
/* 보조 버튼 (스누즈/나중) — 라이트 회색 배경 → 다크 surface + 아이보리 글자 */
[data-theme="dark"] .dash-reminder-toast .dr-btn-snooze,
[data-theme="dark"] .todo-reminder-toast .toast-btn-snooze,
[data-theme="dark"] .meeting-result-toast .mr-btn-consult,
[data-theme="dark"] .meeting-result-toast .mr-btn-later {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    color: rgba(212,212,212,.62) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
/* 색조 의미 버튼 — 색상은 유지하되 다크 톤으로 변환 */
[data-theme="dark"] .dash-reminder-toast .dr-btn-dismiss {
    background: rgba(245,158,11,.18) !important;
    color: #FCD34D !important;
}
[data-theme="dark"] .todo-reminder-toast .toast-btn-dismiss,
[data-theme="dark"] .meeting-result-toast .mr-btn-reject {
    background: rgba(220,38,38,.18) !important;
    color: #FCA5A5 !important;
}
[data-theme="dark"] .meeting-result-toast .mr-btn-contract {
    background: rgba(16,185,129,.18) !important;
    color: #6EE7B7 !important;
}
[data-theme="dark"] .meeting-result-toast .mr-btn-callback {
    background: rgba(59,130,246,.18) !important;
    color: #93C5FD !important;
}

/* ㉒ 페이지 stylesheet 안 직박 라이트 hex — 광범위 catch
   원인: HTML 안 <style> 또는 외부 CSS의 클래스 셀렉터에 color/background hex 직박 →
   §④/§⑳-d 인라인 attribute 셀렉터로는 못 잡음. 명시적 셀렉터 추가 필요.
   매핑: 본문/제목 → #D4D4D4, 보조 → rgba(212,212,212,.62), hover 라이트 배경 → 다크 surface. */

/* §㉒-a 사이드바/사용자 카드 (sidebar-shell.css + dashboard-final.html) */
[data-theme="dark"] .sb-brand,
[data-theme="dark"] .sb-uname,
[data-theme="dark"] .sb-collapse:hover,
[data-theme="dark"] .si:hover,
[data-theme="dark"] .si {
    color: #D4D4D4 !important;
}
[data-theme="dark"] .sb.mini .si,
[data-theme="dark"] .sb-gt,
[data-theme="dark"] .sb-urole,
[data-theme="dark"] .shell-ov-close {
    color: rgba(212,212,212,.62) !important;
}
[data-theme="dark"] .si:hover,
[data-theme="dark"] .sb-collapse:hover {
    background: rgba(255,255,255,.06) !important;
}

/* §㉒-b 대시보드 위젯 자식 텍스트 (dashboard-final.html stylesheet) */
[data-theme="dark"] .gs-edit-bar button,
[data-theme="dark"] .gs-picker h3,
[data-theme="dark"] .gs-picker-card .gpc-name,
[data-theme="dark"] .gw-kpi-item .kv,
[data-theme="dark"] .gw-sched-col .sc-date,
[data-theme="dark"] .gw-todo-item .ti-text,
[data-theme="dark"] .gw-crm-group-hd span {
    color: #D4D4D4 !important;
}
[data-theme="dark"] .gs-edit-bar button {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}

/* §㉒-c customer.html stylesheet (사이드바 검색/아이템, 프로필, 컬럼 메뉴, K카드, 할일) */
[data-theme="dark"] .sb-page-search input,
[data-theme="dark"] .k-card-name,
[data-theme="dark"] .todo-text,
[data-theme="dark"] .dp-header .dp-title,
[data-theme="dark"] .profile-left-field .plf-value,
[data-theme="dark"] .profile-left-product-name,
[data-theme="dark"] .profile-section-title,
[data-theme="dark"] .profile-field-value,
[data-theme="dark"] .profile-product-name,
[data-theme="dark"] .profile-tool-name,
[data-theme="dark"] .profile-settings-panel .setting-item label,
[data-theme="dark"] .col-item input,
[data-theme="dark"] .sidebar-item:hover,
[data-theme="dark"] .folder-header:hover,
[data-theme="dark"] .dp-header .dp-nav button:hover,
[data-theme="dark"] .col-header-menu .chm-item:hover {
    color: #D4D4D4 !important;
}
/* hover 라이트 배경 → 다크 surface */
[data-theme="dark"] .sidebar-item:hover,
[data-theme="dark"] .folder-header:hover,
[data-theme="dark"] .dp-header .dp-nav button:hover,
[data-theme="dark"] .col-header-menu .chm-item:hover {
    background: rgba(255,255,255,.06) !important;
}

/* §㉒-d 가이드 패널 (crm-guide.css) */
[data-theme="dark"] .cg-category-header {
    color: rgba(212,212,212,.38) !important;
}
[data-theme="dark"] .cg-item {
    color: #D4D4D4 !important;
}
[data-theme="dark"] .cg-back-btn {
    color: rgba(212,212,212,.62) !important;
}

/* §㉒-e portal.css 탭/버튼/조직카드 */
[data-theme="dark"] .tab-btn:hover,
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .org-card.lv4,
[data-theme="dark"] .org-member-chip {
    color: #D4D4D4 !important;
}
[data-theme="dark"] .org-action-btn {
    color: rgba(212,212,212,.62) !important;
}
[data-theme="dark"] .org-add-child-btn {
    color: rgba(212,212,212,.38) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}

/* ==========================================================================
 * §㉓ Phase C 통합 가드 (2026-05-10)
 * 사용자 보고: CRM 고객추가, CI활용서 입력카드, 보장분석, 보험전산, 연금설계 입력창,
 *              가이드 패널, 사이드바 등 잔존 라이트 박힘 영역 명시 swap.
 * 전략: 페이지별 공통 클래스 (.page-header/.sim-card/.upload-section)와 컴포넌트별
 *       (.ab-btn/.input-value/.cat-chip/.cg-*) 가드를 한 번에 추가.
 * ========================================================================== */

/* §㉓-a 페이지 로컬 토큰 추가 swap (CI v3/v5, insurance-hub, pension 등) */
:root[data-theme="dark"] {
    /* CI consulting (--t-* 시스템) */
    --t-bg: var(--mw-paper, #000);
    --t-card: var(--mw-white, #1C1C1E);
    --t-text: #D4D4D4;
    --t-sub: rgba(212,212,212,.62);
    --t-muted: rgba(212,212,212,.38);
    --t-light: var(--mw-surface-alt, #2C2C2E);
    --t-border: var(--mw-border, rgba(255,255,255,.08));
    /* --t-blue/red/green/accent은 액션 색상이라 그대로 유지 (다크 위 가독 OK) */
    /* insurance-hub --text-sub */
    --text-sub: rgba(212,212,212,.62);
    /* crm.html --accent-hover (.ab-btn.primary:hover) */
    --accent-hover: rgba(255,255,255,.18);
}

/* §㉓-b tools/* 공통 헤더/카드/업로드 (pension, pdf-analyze, insurance-hub, quick-prep 등) */
[data-theme="dark"] .page-header,
[data-theme="dark"] header.page-header,
[data-theme="dark"] body > header {
    background: var(--mw-white, #1C1C1E) !important;
    border-bottom-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
[data-theme="dark"] .page-header h1,
[data-theme="dark"] header h1 {
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .page-header .back-btn,
[data-theme="dark"] header .back-btn {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}
[data-theme="dark"] .page-header .back-btn:hover,
[data-theme="dark"] header .back-btn:hover {
    background: rgba(255,255,255,.10) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .sim-card {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04) !important;
}
[data-theme="dark"] .upload-section {
    background: var(--mw-white, #1C1C1E) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04) !important;
}
[data-theme="dark"] .upload-area {
    border-color: rgba(176,196,222,.35) !important;
    background: rgba(176,196,222,.06) !important;
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}
[data-theme="dark"] .customer-input-bar {
    background: var(--mw-white, #1C1C1E) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.4) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .customer-input-bar input {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .customer-name-display {
    color: #93C5FD !important;
}

/* §㉓-c crm.html .ab-btn 액션 버튼군 (고객 추가, 도구, 가이드 등 헤더 버튼) */
[data-theme="dark"] .ab-btn {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .ab-btn:hover {
    border-color: var(--mw-border-strong, rgba(255,255,255,.16)) !important;
    background: rgba(255,255,255,.06) !important;
}
[data-theme="dark"] .ab-btn.primary {
    background: rgba(255,255,255,.18) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.24) !important;
}
[data-theme="dark"] .ab-btn.primary:hover {
    background: rgba(255,255,255,.28) !important;
}
/* 색조 의미 변형 (.green/.orange/.yellow) — 색조 유지 + 다크 알파 */
[data-theme="dark"] .ab-btn.green {
    background: rgba(74,222,128,.15) !important;
    color: #6EE7B7 !important;
    border-color: rgba(74,222,128,.3) !important;
}
[data-theme="dark"] .ab-btn.orange {
    background: rgba(249,115,22,.15) !important;
    color: #FDBA74 !important;
    border-color: rgba(249,115,22,.3) !important;
}
[data-theme="dark"] .ab-btn.yellow {
    background: rgba(245,158,11,.15) !important;
    color: #FCD34D !important;
    border-color: rgba(245,158,11,.3) !important;
}

/* §㉓-d sim.html / pension.html .input-value 입력창 (시뮬레이션 입력 박스) */
[data-theme="dark"] .input-value {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
[data-theme="dark"] .input-value:hover {
    border-color: var(--mw-border-strong, rgba(255,255,255,.16)) !important;
}
[data-theme="dark"] .input-value:focus-within {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,.18) !important;
}
[data-theme="dark"] .input-value input {
    color: #93C5FD !important;
    background: transparent !important;
}
[data-theme="dark"] .input-cell.prepay .input-value {
    background: rgba(220,38,38,.12) !important;
    border-color: rgba(220,38,38,.35) !important;
}
[data-theme="dark"] .input-cell.prepay .input-value:focus-within {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.18) !important;
}
[data-theme="dark"] .input-cell.prepay .input-value input {
    color: #FCA5A5 !important;
}

/* §㉓-e crm-guide.css .cg-* 완전 가드 — §㉒-d 보완 */
[data-theme="dark"] .cg-overlay {
    background: rgba(0,0,0,.6) !important;
}
[data-theme="dark"] .cg-panel {
    background: var(--mw-white, #1C1C1E) !important;
    box-shadow: -4px 0 24px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) !important;
}
/* cg-header는 그라디언트 (#1e3a5f → #2563eb) 다크 OK 유지, 글자 흰색 그대로 */
[data-theme="dark"] .cg-search {
    border-bottom-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
[data-theme="dark"] .cg-search input {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .cg-search input:focus {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: #3b82f6 !important;
}
[data-theme="dark"] .cg-category-header:hover {
    background: rgba(255,255,255,.06) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .cg-category-header i {
    color: #93C5FD !important;
}
[data-theme="dark"] .cg-category-header .cg-chevron {
    color: rgba(212,212,212,.38) !important;
}
[data-theme="dark"] .cg-item:hover {
    background: rgba(59,130,246,.18) !important;
    color: #93C5FD !important;
}
[data-theme="dark"] .cg-item:hover i {
    color: #93C5FD !important;
}
[data-theme="dark"] .cg-item i {
    color: rgba(212,212,212,.38) !important;
}

/* §㉓-f insurance-hub.html cat-chip / search-wrap (보험전산 카테고리 칩 + 검색바) */
[data-theme="dark"] .search-wrap input {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .search-wrap input:focus {
    border-color: #93C5FD !important;
    background: var(--mw-white, #1C1C1E) !important;
}
[data-theme="dark"] .cat-chip {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}
[data-theme="dark"] .cat-chip:hover {
    border-color: var(--mw-border-strong, rgba(255,255,255,.16)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .cat-chip.active {
    background: rgba(255,255,255,.18) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.24) !important;
}
[data-theme="dark"] header h1 .hl {
    color: #93C5FD !important;
}
[data-theme="dark"] .section-block .section-label,
[data-theme="dark"] header .site-sub,
[data-theme="dark"] header .desc {
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}

/* §㉓-g customer.html 인라인 "고객 추가" 버튼 — #0070f2 파란 배경 (인라인 hex) */
[data-theme="dark"] [style*="background:#0070f2"],
[data-theme="dark"] [style*="background: #0070f2"],
[data-theme="dark"] [style*="background:#0070F2"],
[data-theme="dark"] [style*="background: #0070F2"] {
    background: rgba(59,130,246,.32) !important;
}

/* §㉓-h Tailwind 100/200/300 단계 보완 — schedule/* + customer.html에 흔함 */
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-slate-100,
[data-theme="dark"] .bg-zinc-100,
[data-theme="dark"] .bg-neutral-100 { background: var(--mw-surface-alt, #2C2C2E) !important; }
[data-theme="dark"] .bg-gray-200,
[data-theme="dark"] .bg-slate-200,
[data-theme="dark"] .bg-zinc-200,
[data-theme="dark"] .bg-neutral-200 { background: rgba(255,255,255,.10) !important; }
[data-theme="dark"] .bg-gray-300,
[data-theme="dark"] .bg-slate-300 { background: rgba(255,255,255,.14) !important; }
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-zinc-800,
[data-theme="dark"] .text-neutral-800 { color: var(--mw-text-1, #D4D4D4) !important; }
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-zinc-200,
[data-theme="dark"] .border-neutral-200 { border-color: var(--mw-border, rgba(255,255,255,.08)) !important; }
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-slate-300 { border-color: var(--mw-border-strong, rgba(255,255,255,.16)) !important; }

/* §㉓-i 사이드바 미니 모드 글자 가독성 보강 — 62% 알파 → 78% */
[data-theme="dark"] .sb.mini .si {
    color: rgba(212,212,212,.78) !important;
}
[data-theme="dark"] .sb-gt {
    color: rgba(212,212,212,.55) !important;
}
[data-theme="dark"] .sb-urole {
    color: rgba(212,212,212,.62) !important;
}

/* §㉓-j CI활용서 V3/V5 (reveal.js) — 입력모드 + 슬라이드 다크 가드
   사용자 보고 (2026-05-10): 입력하는 곳 이외 배경이 눈부심.
   원인: (1) reveal.js theme/white.min.css의 .reveal-viewport background:#fff
        (2) #input-mode { background:#FAFAFA } 직박 hex
        (3) .theme-premium / .theme-warm 의 .reveal .slides section 강제 hex !important
        (4) #input-mode .card{background:#fff}, .ci-q-card 등 카드 직박 hex */

/* J-1 reveal.js core viewport/슬라이드 — theme/white.min.css 우회 */
[data-theme="dark"] .reveal-viewport,
[data-theme="dark"] body.reveal-viewport {
    background: var(--mw-paper, #000) !important;
}
[data-theme="dark"] .reveal {
    background: var(--mw-paper, #000) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .reveal .slides section {
    background: var(--mw-paper, #000) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
/* 테마 변형 강제 hex 우회 — specificity 동률이라 cascade로 dark-mode.css가 이김 */
[data-theme="dark"] .theme-premium .reveal .slides section,
[data-theme="dark"] .theme-warm .reveal .slides section,
[data-theme="dark"] .theme-minimal .reveal .slides section {
    background: var(--mw-paper, #000) !important;
}

/* J-2 reveal.js 텍스트 — theme/white.min.css가 h1~h6를 #222 검정 박음 */
[data-theme="dark"] .reveal h1,
[data-theme="dark"] .reveal h2,
[data-theme="dark"] .reveal h3,
[data-theme="dark"] .reveal h4,
[data-theme="dark"] .reveal h5,
[data-theme="dark"] .reveal h6,
[data-theme="dark"] .reveal p,
[data-theme="dark"] .reveal li,
[data-theme="dark"] .reveal blockquote,
[data-theme="dark"] .reveal td,
[data-theme="dark"] .reveal th {
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .reveal .controls {
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}

/* J-3 #input-mode 배경 — 라이트 #FAFAFA 직박 우회 */
[data-theme="dark"] #input-mode {
    background: var(--mw-paper, #000) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] #input-mode .page-header h1 {
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] #input-mode .page-header p {
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}
[data-theme="dark"] #input-mode .card {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] #input-mode .card-title,
[data-theme="dark"] #input-mode label,
[data-theme="dark"] #input-mode .ac-value,
[data-theme="dark"] #input-mode strong,
[data-theme="dark"] #input-mode b {
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] #input-mode .ac-label,
[data-theme="dark"] #input-mode .help,
[data-theme="dark"] #input-mode .hint,
[data-theme="dark"] #input-mode small {
    color: var(--mw-text-2, rgba(212,212,212,.62)) !important;
}
[data-theme="dark"] #input-mode input[type="text"],
[data-theme="dark"] #input-mode input[type="number"],
[data-theme="dark"] #input-mode input[type="tel"],
[data-theme="dark"] #input-mode input[type="email"],
[data-theme="dark"] #input-mode select,
[data-theme="dark"] #input-mode textarea {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] #input-mode input::placeholder,
[data-theme="dark"] #input-mode textarea::placeholder {
    color: var(--mw-text-3, rgba(212,212,212,.38)) !important;
}

/* J-4 ci-* 슬라이드 컴포넌트 (dark-summary, accent box, q-card 등) */
[data-theme="dark"] .ci-q-card,
[data-theme="dark"] .ci-stat-card,
[data-theme="dark"] .ci-info-box {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] .s-trio-card,
[data-theme="dark"] .s-card,
[data-theme="dark"] .s-compare-col {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
/* ci-dark-summary는 라이트에서도 의도적 다크 배경 → 그대로 유지 */

/* §㉓-k 스케줄 페이지 (schedule/index.html + schedule/css/styles.css)
   사용자 보고 (2026-05-10): 입력하는 곳 이외 배경이 비슷하게 눈부심.
   원인: (1) body에 인라인 style="background-color:#FAFAFA" (대문자 → §④에 background-color: 대문자 변형 누락)
        (2) table { background:#FAF7F2 } 따뜻한 베이지 직박 (§⑦은 td 배경 미처리)
        (3) td:hover { background-color:#f0ecdf } 베이지 호버
        (4) tbody tr:nth-child(even) td { background:#F5F1EA } zebra 베이지
   스코프: body[data-no-shell-wrap]는 schedule 전용 (다른 페이지 영향 X). */

/* K-1 body 인라인 style="background-color:#FAFAFA" (대소문자) — §④ 보완 */
[data-theme="dark"] [style*="background-color:#FAFAFA"],
[data-theme="dark"] [style*="background-color: #FAFAFA"],
[data-theme="dark"] [style*="background-color:#fafafa"],
[data-theme="dark"] [style*="background-color: #fafafa"] {
    background-color: var(--mw-paper, #000) !important;
}

/* K-2 schedule 캘린더 table — 따뜻한 베이지 톤(#FAF7F2/#F5F1EA/#e8e3da) 우회 */
[data-theme="dark"] body[data-no-shell-wrap] table {
    background: transparent !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.4) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] td {
    background: transparent !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] td:hover {
    background-color: rgba(255,255,255,.06) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] tbody tr:nth-child(even) td {
    background: rgba(255,255,255,.03) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] tbody tr:nth-child(even) td:first-child {
    background: var(--mw-surface-alt, #2C2C2E) !important;
}
/* td:first-child base (#eee9e0 베이지) — 모든 행 (홀수 포함) 우회 — 2026-05-11 보강 */
[data-theme="dark"] body[data-no-shell-wrap] td:first-child {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    border-right-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
/* th 컬럼 헤더 (#EDE8DF 베이지) — §⑦ 보강 명시 */
[data-theme="dark"] body[data-no-shell-wrap] th {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
    border-bottom-color: var(--mw-border-strong, rgba(255,255,255,.16)) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] tbody tr.compact-empty-row td,
[data-theme="dark"] body[data-no-shell-wrap] tbody tr.compact-empty-row:hover td {
    background: transparent !important;
}
/* schedule custom Tailwind 클래스 (.bg-indigo-100/.bg-amber-50 등) — schedule styles.css 자체 hex 정의 우회 */
[data-theme="dark"] body[data-no-shell-wrap] .bg-indigo-100 { background: rgba(99,102,241,.18) !important; }
[data-theme="dark"] body[data-no-shell-wrap] .bg-amber-50 { background: rgba(245,158,11,.12) !important; }
[data-theme="dark"] body[data-no-shell-wrap] .bg-amber-50.border-amber-200,
[data-theme="dark"] body[data-no-shell-wrap] .border-amber-200 { border-color: rgba(245,158,11,.35) !important; }
/* result chip (.ok/.maybe/.no — .tl-card, .tl-popover) — schedule이 자체 다크 룰 일부 있지만 .result.no 등 보강 */
[data-theme="dark"] body[data-no-shell-wrap] .result.no,
[data-theme="dark"] body[data-no-shell-wrap] .tl-popover .no { background: var(--mw-surface-alt, #2C2C2E) !important; color: var(--mw-text-2, rgba(212,212,212,.62)) !important; }
[data-theme="dark"] body[data-no-shell-wrap] .result.ok,
[data-theme="dark"] body[data-no-shell-wrap] .tl-popover .ok { background: rgba(74,222,128,.18) !important; color: #6EE7B7 !important; }
[data-theme="dark"] body[data-no-shell-wrap] .result.maybe,
[data-theme="dark"] body[data-no-shell-wrap] .tl-popover .maybe { background: rgba(245,158,11,.18) !important; color: #FCD34D !important; }
/* .event-card-pt (#fff7ed) — 따뜻한 노랑 → 다크 알파 */
[data-theme="dark"] body[data-no-shell-wrap] .event-card-pt { background: rgba(245,158,11,.15) !important; }
[data-theme="dark"] body[data-no-shell-wrap] .event-card-move { background: rgba(139,92,246,.15) !important; border-left-color: #A78BFA !important; }
[data-theme="dark"] body[data-no-shell-wrap] .event-card-admin { background: var(--mw-surface-alt, #2C2C2E) !important; }

/* K-3 schedule 헤더 + 컴포넌트 (.schedule-header, .scheduler-container 등) */
[data-theme="dark"] body[data-no-shell-wrap] .schedule-header,
[data-theme="dark"] body[data-no-shell-wrap] .scheduler-container > header,
[data-theme="dark"] body[data-no-shell-wrap] .scheduler-toolbar {
    background: var(--mw-white, #1C1C1E) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] .event-card-pt {
    background: rgba(245,158,11,.15) !important;
    border-left-color: rgba(245,158,11,.4) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}

/* K-4 schedule 모달/폼 — React로 렌더되며 inline-flex containers 흔함 */
[data-theme="dark"] body[data-no-shell-wrap] [role="dialog"],
[data-theme="dark"] body[data-no-shell-wrap] .modal-card,
[data-theme="dark"] body[data-no-shell-wrap] [class*="Modal"],
[data-theme="dark"] body[data-no-shell-wrap] form > div {
    color: var(--mw-text-1, #D4D4D4);
}

/* K-5 React <Modal> 컴포넌트 — bg-white + rounded-xl/2xl/3xl 조합으로 식별
   사용자 스크린샷 (2026-05-11): "주간 미팅 리마인드" 모달 흰색 박힘.
   원인: Tailwind .bg-white 다크 override가 dark-mode.css에 누락 → 모달/카드 컨테이너 흰 배경.
   안전한 매칭: .bg-white + rounded-xl/2xl/3xl 조합은 모달/큰 카드만 — 토글 thumb(.rounded-full)는 영향 X.
   schedule 외 페이지에도 적용 (body 스코프 제거) — 모든 React Modal 패턴 커버. */
[data-theme="dark"] .bg-white.rounded-xl,
[data-theme="dark"] .bg-white.rounded-2xl,
[data-theme="dark"] .bg-white.rounded-3xl,
[data-theme="dark"] .bg-white.shadow-xl,
[data-theme="dark"] .bg-white.shadow-2xl {
    background-color: var(--mw-white, #1C1C1E) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}

/* K-6 schedule 페이지 .bg-white 전체 swap — 사용자 스크린샷 #2 (2026-05-11): 남은 흰색 영역.
   K-5는 rounded-xl/2xl/3xl AND 조합만 catch → bg-white 단독 또는 .bg-white.rounded-lg 등 누락.
   schedule 한정으로 .bg-white 전체 swap (다른 페이지 영향 X), 토글 thumb(.rounded-full)는 예외. */
[data-theme="dark"] body[data-no-shell-wrap] .bg-white {
    background-color: var(--mw-white, #1C1C1E) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
}
/* 토글 스위치 thumb (w-5 h-5 bg-white rounded-full) 의도된 흰 유지 */
[data-theme="dark"] body[data-no-shell-wrap] .bg-white.rounded-full {
    background-color: #fff !important;
}

/* K-7 글자 콘트라스트 boost — 사용자: 글자가 더 안 보이네.
   §⑮의 --mw-text-2 (62%) / --mw-text-3 (38%)는 schedule 작은 폰트에선 너무 흐림.
   schedule 한정 토큰 boost + Tailwind text-* 명시 강화. */
[data-theme="dark"] body[data-no-shell-wrap] {
    --text-secondary: rgba(212,212,212,.78) !important;
    --text-muted: rgba(212,212,212,.55) !important;
    --mw-text-2: rgba(212,212,212,.78);
    --mw-text-3: rgba(212,212,212,.55);
}
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-400,
[data-theme="dark"] body[data-no-shell-wrap] .text-gray-400,
[data-theme="dark"] body[data-no-shell-wrap] .text-zinc-400 {
    color: rgba(212,212,212,.62) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-500,
[data-theme="dark"] body[data-no-shell-wrap] .text-gray-500,
[data-theme="dark"] body[data-no-shell-wrap] .text-zinc-500 {
    color: rgba(212,212,212,.78) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-600,
[data-theme="dark"] body[data-no-shell-wrap] .text-gray-600,
[data-theme="dark"] body[data-no-shell-wrap] .text-zinc-600 {
    color: rgba(212,212,212,.88) !important;
}
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-700,
[data-theme="dark"] body[data-no-shell-wrap] .text-gray-700,
[data-theme="dark"] body[data-no-shell-wrap] .text-zinc-700,
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-800,
[data-theme="dark"] body[data-no-shell-wrap] .text-slate-900,
[data-theme="dark"] body[data-no-shell-wrap] .text-gray-900 {
    color: var(--mw-text-1, #D4D4D4) !important;
}

/* K-8 schedule "활동 추가" 점선 셀 (dashed) — 점선 보더 색상도 boost */
[data-theme="dark"] body[data-no-shell-wrap] .border-dashed,
[data-theme="dark"] body[data-no-shell-wrap] [class*="border-dashed"] {
    border-color: rgba(255,255,255,.18) !important;
}
/* "계획 없음" 텍스트, 이벤트 카드 본문 — schedule styles.css의 var(--text-muted) 사용처 */
[data-theme="dark"] body[data-no-shell-wrap] .empty-state,
[data-theme="dark"] body[data-no-shell-wrap] .compact-empty-row,
[data-theme="dark"] body[data-no-shell-wrap] .compact-empty-row td {
    color: rgba(212,212,212,.55) !important;
}
/* 모달 내부 미리보기 textarea/input — bg-slate-50은 §⑬에서 catch, .bg-white inputs 보완 */
[data-theme="dark"] .bg-white > textarea,
[data-theme="dark"] .bg-white.rounded-xl textarea,
[data-theme="dark"] .bg-white.rounded-2xl textarea {
    background: var(--mw-surface-alt, #2C2C2E) !important;
    color: var(--mw-text-1, #D4D4D4) !important;
    border-color: var(--mw-border, rgba(255,255,255,.08)) !important;
}
/* 모달 내부 보더 보완 — border-slate-100/200은 흔함 */
[data-theme="dark"] .border-slate-100 { border-color: var(--mw-border, rgba(255,255,255,.08)) !important; }
/* shadow-2xl/shadow-xl — 검정 위 검정 그림자 → 흰 보더 + 강한 그림자 */
[data-theme="dark"] .shadow-2xl {
    box-shadow: 0 16px 48px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08) !important;
}
[data-theme="dark"] .shadow-xl {
    box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06) !important;
}
