/* ===================================================================
   BlogOps Theme v3 — lumexcorp 리뉴얼 시안 톤 + 다크모드 (2026-09-28)
   · 라이트: 연녹색 기운 종이색 캔버스 · 잉크 사이드바 · 라임 포인트
   · 다크: 눈부심 없는 잉크 바탕 · 같은 라임 포인트
   premium.css 다음에 로드. 모든 화면 색은 여기 토큰에서 나온다.
   테마 적용: <html data-theme="light|dark"> (header.php 가 저장값/시스템 설정으로 먼저 찍음)
   =================================================================== */

:root {
    color-scheme: light;
    /* 잉크 · 텍스트 */
    --ink:      #0b0d0c;
    --ink-2:    #1f2420;
    --text:     #4a524b;
    --text-2:   #6b736b;
    --text-3:   #969d95;
    /* 면 · 선 */
    --canvas:   #f5f6f2;
    --surface:  #ffffff;
    --surface-2:#f9faf7;
    --sunk:     #eef1ea;
    --line:     #ecefe8;
    --line-2:   #e3e7df;
    --border:   #d9ded5;
    --border-strong: #c3c9c0;
    /* 라임 포인트 */
    --lime:        #b9ff66;
    --lime-ink:    #0b0d0c;
    --brand:       #b9ff66;
    --brand-strong:#4c9800;
    --brand-deep:  #3d7a00;
    --brand-soft:  #eefbdc;
    --brand-tint:  #f6fdec;
    /* 1차 강조 = 잉크 */
    --primary:       #0b0d0c;
    --primary-dark:  #000000;
    --primary-light: #eef1ea;
    --primary-50:    #f9faf7;
    /* 의미색 (글자용 / 옅은 바탕) */
    --success:       #3d8a12;
    --success-light: #eaf7dc;
    --warning:       #a86a12;
    --warning-light: #fcf1dc;
    --danger:        #d93f3f;
    --danger-light:  #fdeaea;
    --info:          #2f63c7;
    --info-light:    #e8effc;
    --violet:        #6d4fc4;
    --violet-light:  #efeafb;
    --purple:        #6b736b;  --purple-light: #eef1ea;
    --pink:          #6b736b;  --pink-light:   #eef1ea;
    --orange:        #b0672a;  --orange-light: #fbefe3;
    /* 회색 스케일 (옛 코드 호환) */
    --gray-50:#f9faf7; --gray-100:#eef1ea; --gray-200:#e3e7df; --gray-300:#d9ded5; --gray-400:#969d95;
    --gray-500:#6b736b; --gray-600:#4a524b; --gray-700:#1f2420; --gray-800:#161a17; --gray-900:#0b0d0c;
    /* 사이드바 — 시안의 딥 잉크 */
    --side-bg:     #0c0e0d;
    --side-text:   #aab2a9;
    --side-strong: #f2f5ef;
    --side-hover:  #171a18;
    --side-line:   #1c201d;
    --sidebar-bg:  #0c0e0d;
    --sidebar-border: #1c201d;
    /* 그림자 */
    --shadow-xs: 0 1px 2px rgba(11,13,12,.05);
    --shadow-sm: 0 1px 3px rgba(11,13,12,.06);
    --shadow:    0 4px 14px -4px rgba(11,13,12,.10);
    --shadow-md: 0 6px 18px -6px rgba(11,13,12,.14);
    --shadow-lg: 0 12px 32px -10px rgba(11,13,12,.18);
    --shadow-xl: 0 20px 48px -12px rgba(11,13,12,.24);
    /* 토스트·툴팁 (항상 대비 보장) */
    --toast-bg:   #0b0d0c;
    --toast-text: #f2f5ef;
    --on-ink:     #ffffff;
}

/* ── 다크 ── */
:root[data-theme="dark"] {
    color-scheme: dark;
    --ink:      #eef2ea;
    --ink-2:    #dbe1d6;
    --text:     #b9c1b6;
    --text-2:   #939b90;
    --text-3:   #6f776d;
    --canvas:   #0a0c0b;
    --surface:  #121513;
    --surface-2:#161a17;
    --sunk:     #1a1e1b;
    --line:     #1f2420;
    --line-2:   #262b27;
    --border:   #2f3530;
    --border-strong: #3d443e;
    --brand:       #b9ff66;
    --brand-strong:#b9ff66;
    --brand-deep:  #d2ff99;
    --brand-soft:  rgba(185,255,102,.12);
    --brand-tint:  rgba(185,255,102,.06);
    --primary:       #eef2ea;
    --primary-dark:  #ffffff;
    --primary-light: #1a1e1b;
    --primary-50:    #141715;
    --success:       #9fe066;
    --success-light: rgba(159,224,102,.13);
    --warning:       #f0bb5a;
    --warning-light: rgba(240,187,90,.13);
    --danger:        #ff7b76;
    --danger-light:  rgba(255,123,118,.13);
    --info:          #8ab4ff;
    --info-light:    rgba(138,180,255,.13);
    --violet:        #b9a2ff;
    --violet-light:  rgba(185,162,255,.13);
    --purple:        #939b90;  --purple-light: #1a1e1b;
    --pink:          #939b90;  --pink-light:   #1a1e1b;
    --orange:        #f0a261;  --orange-light: rgba(240,162,97,.13);
    --gray-50:#141715; --gray-100:#1a1e1b; --gray-200:#262b27; --gray-300:#2f3530; --gray-400:#6f776d;
    --gray-500:#939b90; --gray-600:#b9c1b6; --gray-700:#dbe1d6; --gray-800:#e6ebe2; --gray-900:#eef2ea;
    --side-bg:     #070908;
    --side-text:   #98a097;
    --side-strong: #f2f5ef;
    --side-hover:  #121513;
    --side-line:   #171b18;
    --sidebar-bg:  #070908;
    --sidebar-border: #171b18;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
    --shadow:    0 6px 18px -6px rgba(0,0,0,.6);
    --shadow-md: 0 8px 22px -8px rgba(0,0,0,.65);
    --shadow-lg: 0 14px 36px -10px rgba(0,0,0,.7);
    --shadow-xl: 0 22px 52px -12px rgba(0,0,0,.75);
    --toast-bg:   #eef2ea;
    --toast-text: #0b0d0c;
    --on-ink:     #0b0d0c;
}

/* ===== 기본 ===== */
html, body { background: var(--canvas) !important; color: var(--text); }
body { font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; }
h1,h2,h3,h4,h5,.card-title,.topbar-title,.stat-value { color: var(--ink); }
a { color: inherit; }
::selection { background: var(--lime); color: var(--lime-ink); }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.main-content, .content-area { background: var(--canvas) !important; }

/* ===== 사이드바 (딥 잉크) ===== */
.sidebar { background: var(--side-bg) !important; border-right: 1px solid var(--side-line) !important; }
.sidebar-logo { border-bottom-color: var(--side-line) !important; }
.sidebar-logo-text, .sidebar-logo-text * { color: var(--side-strong) !important; }
.sidebar-logo-text small, .sidebar-logo-text span:not(:first-child) { color: var(--side-text) !important; }
.sidebar-logo-icon { background: var(--lime) !important; color: var(--lime-ink) !important; }
.sidebar-logo-icon svg { stroke: var(--lime-ink) !important; }
.sidebar-nav .nav-item { color: var(--side-text) !important; background: transparent !important; }
.sidebar-nav .nav-item:hover { background: var(--side-hover) !important; color: var(--side-strong) !important; }
.sidebar-nav .nav-item.active { background: var(--lime) !important; color: var(--lime-ink) !important; font-weight: 600; }
.sidebar-nav .nav-item.active .nav-icon-wrap, .sidebar-nav .nav-item.active svg { color: var(--lime-ink) !important; stroke: var(--lime-ink) !important; background: transparent !important; }
.nav-divider { background: var(--side-line) !important; border-color: var(--side-line) !important; }
.nav-section-title, .nav-group-title { color: #5d665c !important; }
.nav-badge { background: #ff5d57 !important; color: #fff !important; }
.sidebar-nav .nav-item.active .nav-badge { background: var(--lime-ink) !important; color: var(--lime) !important; }
.sidebar-footer { border-top-color: var(--side-line) !important; color: var(--side-text) !important; }
.sidebar-footer * { color: var(--side-text) !important; }
.ws-switcher { border-color: var(--side-line) !important; }
.ws-item { background: #151816 !important; color: var(--side-text) !important; border: 1px solid #222723 !important; }
.ws-item:hover { color: var(--side-strong) !important; border-color: #353b36 !important; }
.ws-item.active { background: var(--lime) !important; color: var(--lime-ink) !important; border-color: var(--lime) !important; }
.ws-dot { background: currentColor !important; }

/* ===== 상단바 ===== */
.topbar { background: color-mix(in srgb, var(--canvas) 88%, transparent) !important; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2) !important; }
.topbar-date, .topbar-user-name { color: var(--text-2) !important; }
.topbar-bell { color: var(--text) !important; background: var(--surface) !important; border: 1px solid var(--line-2) !important; }
.topbar-avatar { background: var(--ink) !important; color: var(--on-ink) !important; }
.theme-toggle { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.theme-toggle:hover { color: var(--ink); border-color: var(--border); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.user-dropdown, .notif-dropdown { background: var(--surface) !important; border: 1px solid var(--line-2) !important; box-shadow: var(--shadow-lg) !important; color: var(--text) !important; }
.notif-dropdown * { border-color: var(--line) !important; }
.notif-item.unread, .notif-dropdown .unread { background: var(--brand-tint) !important; }

/* ===== 카드 · 통계 ===== */
.card, .stat-card, .modal, .login-card, .empty-state, .filter-bar, .banner { background: var(--surface) !important; border-color: var(--line-2) !important; color: var(--text); }
.card { box-shadow: var(--shadow-xs) !important; }
.card-header, .card-footer, .modal-header, .modal-footer { border-color: var(--line) !important; background: transparent !important; }
.stat-icon { background: var(--sunk) !important; color: var(--ink) !important; }
.stat-label, .card-subtitle { color: var(--text-2) !important; }

/* ===== 표 ===== */
.table-wrapper { background: var(--surface) !important; border-color: var(--line-2) !important; }
table th { background: var(--surface-2) !important; color: var(--text-2) !important; border-color: var(--line) !important; }
table td { border-color: var(--line) !important; color: var(--text); }
table tbody tr:hover td { background: var(--brand-tint) !important; }

/* ===== 버튼 ===== */
.btn { border-color: var(--border) !important; }
.btn-primary, .btn.primary { background: var(--ink) !important; color: var(--on-ink) !important; border-color: var(--ink) !important; }
.btn-primary:hover { filter: brightness(1.15); }
:root[data-theme="dark"] .btn-primary:hover { filter: brightness(.92); }
.btn-secondary, .btn-outline, .btn-light, .btn-ghost { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--border) !important; }
.btn-secondary:hover, .btn-outline:hover { background: var(--sunk) !important; }
.btn-success { background: var(--lime) !important; color: var(--lime-ink) !important; border-color: var(--lime) !important; }
.btn-danger { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }
:root[data-theme="dark"] .btn-danger { color: #1a0707 !important; }

/* ===== 입력 ===== */
.form-input, .form-select, .form-textarea, .filter-select, .search-box input,
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="email"],
input[type="password"], input[type="tel"], input[type="url"], input[type="month"], input[type="time"], select, textarea {
    background-color: var(--surface) !important; color: var(--ink) !important; border-color: var(--border) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-3) !important; }
.form-label, label { color: var(--text); }

/* ===== 배지 · 탭 · 페이지네이션 ===== */
.sub-tabs, .bank-tabs { border-color: var(--line-2) !important; }
.sub-tab { color: var(--text-2) !important; }
.sub-tab.active { color: var(--ink) !important; border-color: var(--ink) !important; }
.pagination a, .pagination span { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.pagination .active, .pagination a.active { background: var(--ink) !important; color: var(--on-ink) !important; }
.progress-fill, .bar-fill, .chart-bar-fill { background: var(--brand-strong) !important; }

/* ===== 알림 박스 ===== */
.alert-info    { background: var(--info-light) !important;    color: var(--info) !important;    border-color: transparent !important; }
.alert-success { background: var(--success-light) !important; color: var(--success) !important; border-color: transparent !important; }
.alert-warning { background: var(--warning-light) !important; color: var(--warning) !important; border-color: transparent !important; }
.alert-danger  { background: var(--danger-light) !important;  color: var(--danger) !important;  border-color: transparent !important; }
.alert a { color: inherit !important; }

/* ===== 토스트 (예전: 잉크 바탕 + 잉크 글자로 안 보이던 문제) ===== */
.toast, .toast.info, .toast.success { background: var(--toast-bg) !important; color: var(--toast-text) !important; border: 0 !important; box-shadow: var(--shadow-lg) !important; }
.toast.error   { background: var(--danger) !important;  color: #fff !important; }
.toast.warning { background: var(--warning) !important; color: #fff !important; }
.toast * { color: inherit !important; }
.toast.success::before { background: var(--lime) !important; color: var(--lime-ink) !important; }

/* ===== 모달 · 오버레이 ===== */
.modal-overlay { background: rgba(5,7,6,.55) !important; }
.modal { box-shadow: var(--shadow-xl) !important; }

/* ===== 스크롤바 (다크) ===== */
:root[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a302b; border-radius: 10px; border: 2px solid var(--canvas); }
:root[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--canvas); }

/* ===== 다크 보정: 인라인으로 박힌 흰 바탕·연한 틴트 ===== */
:root[data-theme="dark"] img { opacity: .94; }
:root[data-theme="dark"] [style*="background:#fff"], :root[data-theme="dark"] [style*="background: #fff"],
:root[data-theme="dark"] [style*="background:white"], :root[data-theme="dark"] [style*="background-color:#fff"],
:root[data-theme="dark"] [style*="background: white"], :root[data-theme="dark"] [style*="background:#ffffff"] { background: var(--surface) !important; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* === 다크 보정 (codemod 후, 2026-09-28) === */
/* 잉크 알약 탭: premium.css 가 잉크 바탕을 깔므로 글자는 on-ink */
.sub-tab.active { background: var(--ink) !important; color: var(--on-ink) !important; }
/* 빨강 바탕 + 흰 글자: 다크에서 빨강이 밝아지므로 글자를 어둡게 */
:root[data-theme="dark"] [style*="background:var(--danger)"], :root[data-theme="dark"] [style*="background: var(--danger)"],
:root[data-theme="dark"] .toast.error, :root[data-theme="dark"] .toast.warning { color: #1a0707 !important; }
/* gray-300 은 다크에서 선 색이라 글자로는 안 보임 */
:root[data-theme="dark"] [style*="color:var(--gray-300)"], :root[data-theme="dark"] [style*="color: var(--gray-300)"] { color: var(--text-3) !important; }
/* 사이드바 로고 글자: premium.css 의 text-fill 이 잉크라 라이트에서 사이드바에 묻힘 */
.sidebar-logo-text h1 { -webkit-text-fill-color: var(--side-strong) !important; }
/* 자비스 터미널 입력창은 항상 터미널 색 (전역 input 규칙 제외) */
#jvIn, .jv-inrow input, .jv-inrow textarea { background: transparent !important; color: #e6e9ed !important; border: 0 !important; box-shadow: none !important; }
