﻿/**
 * ============================================
 * ONECLOUD Design System v2.0
 * ============================================
 */

:root {
    /* Sidebar Colors (항상 고정 - 다크모드 영향 없음) */
    --sidebar-bg: #1e293b;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.1);
    --sidebar-bg-active: rgba(255, 255, 255, 0.15);
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.6);
    --sidebar-text-hover: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-icon: #ffffff;
    --sidebar-icon-muted: rgba(255, 255, 255, 0.7);
}

/* ============================================
   1. Layout Structure
   ============================================ */

#app-side-nav-outer-toolbar {
    flex-direction: column;
    display: flex;
    height: 100%;
    width: 100%;
}

/* Layout Header */
.layout-header {
    flex: 0 0 auto;
    box-shadow: var(--shadow-md);
    background-color: var(--color-bg-layout-header);
    position: relative;
    padding: 0 16px;
    z-index: var(--z-header);
    transition: background-color var(--transition-slow), box-shadow var(--transition-slow);
}

#maintoptoolbar {
    background-color: var(--color-bg-layout-header);
    transition: background-color var(--transition-slow);
}

/* Layout Body */
.layout-body {
    background-color: var(--color-bg-body);
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    transition: background-color var(--transition-slow);
}

.layout-body-hidden {
    visibility: hidden;
}

/* ============================================
   2. Logo & Branding
   ============================================ */

.top-logo {
    display: flex;
    align-items: center;
    min-width: 200px;
    gap: 12px;
}

.top-logo-img {
    display: flex;
    align-items: center;
}

    .top-logo-img > img {
        max-height: 32px;
        margin-left: 16px;
        transition: filter var(--transition-fast);
    }

.top-logo-txt {
    display: flex;
    align-items: center;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-lg);
    color: var(--color-top-logo-txt);
    transition: color var(--transition-slow);
}

#home_banner {
    filter: var(--color-banner);
    transition: filter var(--transition-slow);
}

/* ============================================
   3. Sidebar Menu
   ============================================ */

.layout-body .menu-container {
    height: 100%;
    width: 260px;
    min-width: 260px;
    position: relative;
    background-color: var(--color-bg-sidebar);
    transition: background-color var(--transition-slow);
}

.menu-container .dx-widget {
    color: var(--color-text-inverse);
    font-weight: var(--font-weight-medium);
    line-height: 1.6;
}

.menu-container .dx-treeview-search {
    margin: 12px 0;
    line-height: 1.4;
}

.menu-container .dx-treeview {
    white-space: nowrap;
}

    .menu-container .dx-treeview .dx-treeview-item {
        padding: 8px 0;
        min-height: 28px;
        transition: background-color var(--transition-fast), color var(--transition-fast);
    }

        .menu-container .dx-treeview .dx-treeview-item.dx-state-hover {
            color: var(--color-text-inverse);
        }

        .menu-container .dx-treeview .dx-treeview-item .dx-icon {
            margin-right: 12px;
            margin-left: 12px;
            opacity: 0.9;
        }

    .menu-container .dx-treeview .dx-treeview-toggle-item-visibility {
        right: 12px;
        left: auto;
    }

    .menu-container .dx-treeview .dx-rtl .dx-treeview-toggle-item-visibility {
        left: 12px;
        right: auto;
    }

    /* Menu Levels */
    .menu-container .dx-treeview .dx-treeview-node[aria-level="1"] {
        font-weight: var(--font-weight-semibold);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .menu-container .dx-treeview .dx-treeview-node[aria-level="2"] .dx-treeview-item-content {
        font-weight: var(--font-weight-normal);
        padding: 0 16px;
    }

    .menu-container .dx-treeview .dx-treeview-node[aria-level="3"] .dx-treeview-item-content {
        font-weight: var(--font-weight-normal);
        padding: 0 28px;
    }

    .menu-container .dx-treeview .dx-treeview-node[aria-level="4"] .dx-treeview-item-content {
        font-weight: var(--font-weight-normal);
        padding: 0 40px;
    }

    /* Menu States */
    .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected:not(.dx-state-focused) > .dx-treeview-item {
        background: transparent;
    }

    .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected > .dx-treeview-item * {
        color: var(--color-accent);
    }

    .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node:not(.dx-state-focused) > .dx-treeview-item.dx-state-hover {
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-sm);
    }

    /* Menu Icons */
    .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content .dx-icon.fa.fa.fa-circle-o {
        font-size: 0.875em;
    }

    .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content .dx-icon.fa.fa.fa-folder,
    .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content .dx-icon.fa.fa.fa-folder-open {
        font-size: 1.1em;
    }

/* Menu Search */
#mainmenutree .dx-placeholder {
    font-weight: var(--font-weight-medium);
    color: rgba(255, 255, 255, 0.6);
    padding-left: 20px;
    font-size: var(--font-size-base);
}

#mainmenutree .dx-texteditor-input {
    margin-left: 20px;
    padding-bottom: 0;
    color: var(--color-text-inverse);
}

#mainmenutree .dx-texteditor-container {
    padding-bottom: 8px;
}

#mainmenutree .dx-icon-search {
    font-size: 20px;
    top: 30%;
}

    #mainmenutree .dx-icon-search:before {
        color: var(--color-text-inverse);
        padding-left: 12px;
        margin-bottom: -4px;
    }

#mainmenutree .dx-texteditor.dx-editor-underlined:after {
    width: 90%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: absolute;
    left: 5%;
}

#mainmenutree .dx-treeview-node {
    padding-left: 0;
}

#mainmenutree .dx-treeview-toggle-item-visibility {
    color: transparent;
}

#mainmenutree .dx-treeview-node-container .dx-treeview-node .dx-treeview-node-container-opened {
    background: rgba(0, 0, 0, 0.2);
}

/* Menu Logo Footer */
.mainmenutree-logo {
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 0;
    font-size: var(--font-size-xs);
}

/* System Menu */
#sysmenu .dx-button-content {
    justify-content: center;
}

#sysmenu .dx-icon-preferences {
    color: var(--color-text-inverse);
    margin-right: auto;
}

#sysmenu .dx-icon-spindown {
    color: var(--color-text-inverse);
    margin-left: auto;
}

#sysmenu .dx-buttongroup-item {
    border: none;
    width: 100%;
}

/* ============================================
   4. Content Area
   ============================================ */

.layout-body .content {
    flex-grow: 1;
    height: 100%;
    line-height: var(--line-height-normal);
    position: relative;
    overflow: hidden;
}

    .layout-body .content h2 {
        font-size: var(--font-size-2xl);
        font-weight: var(--font-weight-normal);
        letter-spacing: -0.5px;
    }

.layout-body .content-block {
    /* Spacing managed by child elements */
}

    .layout-body .content-block .caption {
        color: var(--color-text-secondary);
        background-color: var(--color-bg-surface);
        font-size: var(--font-size-md);
        padding: 12px 16px;
        margin: 0;
        border-bottom: 1px solid var(--color-border);
    }

.layout-body .responsive-paddings {
    padding: 0 16px;
}

/* ============================================
   5. Footer
   ============================================ */

.layout-body .content-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    min-height: 36px;
    color: var(--color-footer);
    border-top: 1px solid var(--color-footer-border);
    background-color: var(--color-bg-surface);
    font-size: var(--font-size-xs);
    transition: all var(--transition-slow);
}

    .layout-body .content-footer .content-footer-message {
        width: 50%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .layout-body .content-footer .content-footer-copyright {
        margin-left: auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0.8;
    }

    .layout-body .content-footer .content-footer-userchange {
        /* Reserved for user change button */
    }

/* ============================================
   6. User Panel (내 정보 패널) - 다크 모드 완전 지원
   ============================================ */

.layout-body .content .iz-panel-right {
    position: absolute;
    top: 8px;
    right: 16px;
    width: 320px;
    height: calc(100% - 16px);
    z-index: var(--z-modal);
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-slow);
}

.layout-body .content .iz-panel-right-title {
    padding: 16px;
    text-align: center;
    font-weight: var(--font-weight-semibold);
    border-bottom: 1px solid var(--color-border);
}

/* 사용자 정보 패널 (내 정보) */
.layout-body .content .iz-panel-userinfo {
    position: absolute;
    top: 8px;
    right: 80px;
    width: 320px;
    height: auto;
    max-height: 50%;
    z-index: var(--z-modal);
    background-color: var(--color-bg-panel-content);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transition: all var(--transition-slow);
}

.layout-body .content .iz-panel-userinfo-header {
    width: 100%;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-bg-panel-boxshadow);
    background-color: var(--color-bg-panel);
    text-align: center;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.layout-body .content .iz-panel-userinfo-title {
    width: 100%;
    padding: 8px 16px;
    text-align: center;
    color: var(--color-text-primary);
}

.layout-body .content .iz-panel-userinfo-contents {
    display: flex;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
}

.layout-body .content .iz-panel-userinfo-content {
    background-color: var(--color-bg-panel);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--color-text-primary);
}

.layout-body .content .iz-panel-userinfo-bottom {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 12px 16px;
    border-top: 1px solid var(--color-bg-panel-boxshadow);
    background-color: var(--color-bg-panel);
    text-align: center;
}

.iz-panel-userinfo-usertype {
    font-size: var(--font-size-xs);
    color: var(--color-text-inverse);
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-medium);
}

    .iz-panel-userinfo-usertype.master {
        background-color: var(--color-error);
    }

    .iz-panel-userinfo-usertype.normal {
        background-color: var(--color-gray-600);
    }

/* ============================================
   6-1. User Panel 다크 모드 명시적 스타일 (중요!)
   ============================================ */

/* 다크 모드 - 사용자 정보 패널 전체 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo,
[data-theme="dark"] .iz-panel-userinfo,
html[data-theme="dark"] .iz-panel-userinfo,
body[data-theme="dark"] .iz-panel-userinfo {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* 다크 모드 - 사용자 정보 패널 헤더 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo-header,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo-header,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo-header,
[data-theme="dark"] .iz-panel-userinfo-header,
html[data-theme="dark"] .iz-panel-userinfo-header,
body[data-theme="dark"] .iz-panel-userinfo-header {
    background-color: #1e293b !important;
    border-bottom-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* 다크 모드 - 사용자 정보 패널 타이틀 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo-title,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo-title,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo-title,
[data-theme="dark"] .iz-panel-userinfo-title,
html[data-theme="dark"] .iz-panel-userinfo-title,
body[data-theme="dark"] .iz-panel-userinfo-title {
    color: #f1f5f9 !important;
}

/* 다크 모드 - 사용자 정보 패널 컨텐츠 영역 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo-contents,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo-contents,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo-contents,
[data-theme="dark"] .iz-panel-userinfo-contents,
html[data-theme="dark"] .iz-panel-userinfo-contents,
body[data-theme="dark"] .iz-panel-userinfo-contents {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* 다크 모드 - 사용자 정보 패널 컨텐츠 박스 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo-content,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo-content,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo-content,
[data-theme="dark"] .iz-panel-userinfo-content,
html[data-theme="dark"] .iz-panel-userinfo-content,
body[data-theme="dark"] .iz-panel-userinfo-content {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3) !important;
}

/* 다크 모드 - 사용자 정보 패널 하단 */
[data-theme="dark"] .layout-body .content .iz-panel-userinfo-bottom,
html[data-theme="dark"] .layout-body .content .iz-panel-userinfo-bottom,
body[data-theme="dark"] .layout-body .content .iz-panel-userinfo-bottom,
[data-theme="dark"] .iz-panel-userinfo-bottom,
html[data-theme="dark"] .iz-panel-userinfo-bottom,
body[data-theme="dark"] .iz-panel-userinfo-bottom {
    background-color: #1e293b !important;
    border-top-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* 다크 모드 - iz-panel-right */
[data-theme="dark"] .layout-body .content .iz-panel-right,
html[data-theme="dark"] .layout-body .content .iz-panel-right,
body[data-theme="dark"] .layout-body .content .iz-panel-right,
[data-theme="dark"] .iz-panel-right,
html[data-theme="dark"] .iz-panel-right,
body[data-theme="dark"] .iz-panel-right {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .layout-body .content .iz-panel-right-title,
html[data-theme="dark"] .layout-body .content .iz-panel-right-title,
body[data-theme="dark"] .layout-body .content .iz-panel-right-title,
[data-theme="dark"] .iz-panel-right-title,
html[data-theme="dark"] .iz-panel-right-title,
body[data-theme="dark"] .iz-panel-right-title {
    border-bottom-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* 다크 모드 - 사용자 정보 패널 내부 텍스트 */
[data-theme="dark"] .iz-panel-userinfo *,
html[data-theme="dark"] .iz-panel-userinfo *,
body[data-theme="dark"] .iz-panel-userinfo * {
    color: #f1f5f9;
}

/* 다크 모드 - 사용자 정보 패널 내부 링크 */
[data-theme="dark"] .iz-panel-userinfo a,
html[data-theme="dark"] .iz-panel-userinfo a,
body[data-theme="dark"] .iz-panel-userinfo a {
    color: #38bdf8 !important;
}

/* 다크 모드 - 사용자 정보 패널 내부 버튼 */
[data-theme="dark"] .iz-panel-userinfo .dx-button,
html[data-theme="dark"] .iz-panel-userinfo .dx-button,
body[data-theme="dark"] .iz-panel-userinfo .dx-button {
    background-color: #475569 !important;
    color: #f1f5f9 !important;
    border-color: #64748b !important;
}

    [data-theme="dark"] .iz-panel-userinfo .dx-button:hover,
    html[data-theme="dark"] .iz-panel-userinfo .dx-button:hover,
    body[data-theme="dark"] .iz-panel-userinfo .dx-button:hover {
        background-color: #64748b !important;
    }

    [data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-success,
    html[data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-success,
    body[data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-success {
        background-color: #fb923c !important;
        color: #0f172a !important;
    }

    [data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-danger,
    html[data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-danger,
    body[data-theme="dark"] .iz-panel-userinfo .dx-button.dx-button-danger {
        background-color: #f87171 !important;
    }

/* 다크 모드 - 사용자 타입 배지 */
[data-theme="dark"] .iz-panel-userinfo-usertype,
html[data-theme="dark"] .iz-panel-userinfo-usertype,
body[data-theme="dark"] .iz-panel-userinfo-usertype {
    color: #ffffff !important;
}

    [data-theme="dark"] .iz-panel-userinfo-usertype.normal,
    html[data-theme="dark"] .iz-panel-userinfo-usertype.normal,
    body[data-theme="dark"] .iz-panel-userinfo-usertype.normal {
        background-color: #64748b !important;
    }

/* ============================================
   7. Cards
   ============================================ */

.iz-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    transition: background-color var(--transition-slow);
}

    .iz-card.wide-card {
        border-radius: 0;
        margin-left: 0;
        margin-right: 0;
        border-right: 0;
        border-left: 0;
    }

/* 다크 모드 카드 */
[data-theme="dark"] .iz-card,
html[data-theme="dark"] .iz-card,
body[data-theme="dark"] .iz-card {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* ============================================
   8. Submenu Tabs
   ============================================ */

.iz-submenu {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    margin-left: 16px;
    height: 28px !important;
    gap: 2px;
}

    .iz-submenu .dx-tabs-wrapper .dx-tab {
        background-color: var(--color-submenu-bg);
        color: var(--color-text-inverse);
        padding: 0 16px;
        min-width: 100px;
        z-index: 1;
        box-shadow: var(--shadow-sm);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        transition: all var(--transition-fast);
    }

        .iz-submenu .dx-tabs-wrapper .dx-tab::before,
        .iz-submenu .dx-tabs-wrapper .dx-tab::after {
            display: block;
            content: " ";
            position: absolute;
            top: 0;
            height: 100%;
            width: 10px;
            z-index: 1;
            background-color: var(--color-submenu-bg);
            transition: background-color var(--transition-fast);
        }

        .iz-submenu .dx-tabs-wrapper .dx-tab::before {
            right: -5px;
            left: auto;
            transform: skew(-15deg, 0deg);
            border-radius: 0 0 var(--radius-md) 0;
        }

        .iz-submenu .dx-tabs-wrapper .dx-tab::after {
            left: -5px;
            transform: skew(15deg, 0deg);
            border-radius: 0 0 0 var(--radius-md);
        }

        .iz-submenu .dx-tabs-wrapper .dx-tab.dx-tab-selected {
            background-color: var(--color-iz-main) !important;
            color: var(--color-text-inverse) !important;
            z-index: 2;
            font-weight: var(--font-weight-semibold) !important;
        }

            .iz-submenu .dx-tabs-wrapper .dx-tab.dx-tab-selected .dx-tab-text {
                font-weight: var(--font-weight-semibold);
            }

            .iz-submenu .dx-tabs-wrapper .dx-tab.dx-tab-selected::before,
            .iz-submenu .dx-tabs-wrapper .dx-tab.dx-tab-selected::after {
                background-color: var(--color-iz-main) !important;
            }

        .iz-submenu .dx-tabs-wrapper .dx-tab:hover {
            background-color: var(--color-iz-main);
            color: var(--color-text-inverse);
            z-index: 2;
        }

            .iz-submenu .dx-tabs-wrapper .dx-tab:hover::before,
            .iz-submenu .dx-tabs-wrapper .dx-tab:hover::after {
                background-color: var(--color-iz-main);
            }

/* ============================================
   9. Tab Container
   ============================================ */

.tab-container {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 8px;
    margin-bottom: -8px;
}

.tab-container-header {
    /* Reserved for header content */
}

.tab-container-search {
    display: flex;
    flex-direction: row;
    box-shadow: none;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 16px;
    background-color: var(--color-bg-tab-search);
    min-height: 44px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-slow);
}

.tab-container-search2 {
    display: flex;
    flex-direction: row;
    box-shadow: none;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    background-color: var(--color-bg-tab-search);
    transition: background-color var(--transition-slow);
}

.tab-container-body {
    flex: 1;
    overflow: auto;
}

.tab-container-body-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.tab-container-body-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tab-container-footer {
    /* Reserved for footer content */
}

/* 다크 모드 탭 컨테이너 */
[data-theme="dark"] .tab-container-search,
html[data-theme="dark"] .tab-container-search,
body[data-theme="dark"] .tab-container-search {
    background-color: #334155 !important;
}

[data-theme="dark"] .tab-container-search2,
html[data-theme="dark"] .tab-container-search2,
body[data-theme="dark"] .tab-container-search2 {
    background-color: #334155 !important;
}

/* ============================================
   10. Popup Container
   ============================================ */

.popup-container {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 8px;
}

.popup-container-search {
    display: flex;
    flex-direction: row;
    box-shadow: none;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 16px;
    gap: 16px;
    background-color: var(--color-bg-tab-search);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-slow);
}

.popup-container-body {
    flex: 1;
    overflow: auto;
}

.popup-container-group-caption {
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    gap: 8px;
}

.popup-container-button {
    display: flex;
    gap: 8px;
}

.popup-container-body-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.popup-container-body-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 다크 모드 팝업 컨테이너 */
[data-theme="dark"] .popup-container-search,
html[data-theme="dark"] .popup-container-search,
body[data-theme="dark"] .popup-container-search {
    background-color: #334155 !important;
}

/* ============================================
   11. Search Panel
   ============================================ */

.search-panel {
    background-color: var(--color-bg-tab-search);
    border-radius: var(--radius-md);
    padding: 12px 16px !important;
    margin: 8px 0;
    transition: background-color var(--transition-slow);
}

/* 다크 모드 검색 패널 */
[data-theme="dark"] .search-panel,
html[data-theme="dark"] .search-panel,
body[data-theme="dark"] .search-panel {
    background-color: #334155 !important;
}

/* ============================================
   12. Widget Styles
   ============================================ */

.iz_widget {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.iz_widget-label {
    margin-top: 4px;
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

.iz_widget-value {
    /* Value container */
}

.iz_form-label {
    color: var(--color-text-tertiary);
    margin-right: 32px;
}

.iz_form-value {
    /* Value container */
}

.widget-container {
    padding: 8px;
}

/* 다크 모드 위젯 */
[data-theme="dark"] .iz_widget-label,
html[data-theme="dark"] .iz_widget-label,
body[data-theme="dark"] .iz_widget-label {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .iz_form-label,
html[data-theme="dark"] .iz_form-label,
body[data-theme="dark"] .iz_form-label {
    color: #94a3b8 !important;
}

/* ============================================
   13. Banner
   ============================================ */

.home_banner {
    width: 100%;
    height: 100%;
    margin-top: 12px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ============================================
   14. My Job & Notifications
   ============================================ */

#myjob_message_icon .dx-tab .dx-badge {
    background-color: var(--color-accent);
    color: var(--color-text-inverse);
    margin-top: -4px;
    margin-left: -8px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.iz-myjob-button {
    padding: 0 4px;
}

.iz-myjob-button-icon {
    margin-top: -2px;
    margin-right: 4px;
}

.iz-myjob-button-badge {
    background-color: var(--color-bg-darkgray);
    color: var(--color-text-inverse);
    margin-top: -4px;
    margin-left: -6px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
}

.iz-myjob-button-badge-fill {
    background-color: var(--color-accent);
    color: var(--color-text-inverse);
    margin-top: -4px;
    margin-left: -6px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.iz-myjob-button-progress {
    width: 100%;
    height: 4px;
    position: absolute;
    bottom: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

/* ============================================
   15. Common Elements
   ============================================ */

.common-header-border {
    border-bottom: 1px solid var(--color-common-header-border);
}

/* Form Editor Button */
.dx-widget.dx-button.dx-button-mode-contained.dx-button-success.dx-button-has-icon.iz-editorbtn {
    margin: 2px 2px 2px 0;
    max-height: 24px;
    max-width: 24px;
    border-radius: var(--radius-sm);
}

/* ============================================
   16. Dark Mode Switch
   ============================================ */

.sw_darkmode {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    font-size: var(--font-size-sm);
}

/* User Change Button */
.btn-UserChange > div > img {
    filter: invert(0);
    transition: filter var(--transition-fast);
}

.btn-UserChange.dark > div > img {
    filter: invert(1);
}

/* ============================================
   17. Input States
   ============================================ */

.edt-basic {
    background-color: var(--color-bg-edit-basic) !important;
}

.edt-readonly {
    background-color: var(--color-bg-edit-readonly) !important;
    color: var(--color-readonly-text);
}

.edt-false {
    background-color: var(--color-bg-edit) !important;
}

/* 다크 모드 입력 상태 */
[data-theme="dark"] .edt-basic,
html[data-theme="dark"] .edt-basic,
body[data-theme="dark"] .edt-basic {
    background-color: #334155 !important;
}

[data-theme="dark"] .edt-readonly,
html[data-theme="dark"] .edt-readonly,
body[data-theme="dark"] .edt-readonly {
    background-color: #334155 !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

[data-theme="dark"] .edt-false,
html[data-theme="dark"] .edt-false,
body[data-theme="dark"] .edt-false {
    background-color: #334155 !important;
}

/* ============================================
   18. Tab List
   ============================================ */

.iz-tablist {
    margin-bottom: 12px;
}

    .iz-tablist .dx-tabs {
        background-color: var(--color-tablist-bg);
        border-bottom: 2px solid var(--color-iz-main);
        transition: all var(--transition-slow);
    }

    .iz-tablist .dx-tabs-wrapper {
        margin-left: 12px;
        display: flex;
        position: relative;
        z-index: 1;
        background-color: transparent;
    }

        .iz-tablist .dx-tabs-wrapper .dx-tab {
            padding: 0 12px;
            background-color: var(--color-iz-main);
            min-width: 100px;
            height: 28px;
            border-radius: var(--radius-md) var(--radius-md) 0 0;
            margin-left: -2px;
            color: var(--color-text-inverse);
            z-index: 3;
            transition: all var(--transition-fast);
        }

            .iz-tablist .dx-tabs-wrapper .dx-tab::before,
            .iz-tablist .dx-tabs-wrapper .dx-tab::after {
                display: block;
                content: " ";
                position: absolute;
                top: 0;
                height: 100%;
                width: 10px;
                background-color: var(--color-iz-main);
                transition: background-color var(--transition-fast);
            }

            .iz-tablist .dx-tabs-wrapper .dx-tab::before {
                right: -5px;
                left: auto;
                transform: skew(15deg, 0deg);
                border-radius: 0 var(--radius-md) 0 0;
            }

            .iz-tablist .dx-tabs-wrapper .dx-tab::after {
                left: -5px;
                transform: skew(-15deg, 0deg);
                border-radius: var(--radius-md) 0 0 0;
            }

            .iz-tablist .dx-tabs-wrapper .dx-tab:not(.dx-tab-selected),
            .iz-tablist .dx-tabs-wrapper .dx-tab:not(.dx-tab-selected)::before,
            .iz-tablist .dx-tabs-wrapper .dx-tab:not(.dx-tab-selected)::after {
                background-color: var(--color-submenu-bg);
                border: 0;
                color: var(--color-text-inverse);
                z-index: 2;
            }

            .iz-tablist .dx-tabs-wrapper .dx-tab:hover,
            .iz-tablist .dx-tabs-wrapper .dx-tab:hover::before,
            .iz-tablist .dx-tabs-wrapper .dx-tab:hover::after {
                background-color: var(--color-iz-main);
                color: var(--color-text-inverse);
            }

/* ============================================
   19. Grid Buttons
   ============================================ */

.iz-grid-button {
    margin: 0 auto;
    padding: 4px 8px;
    max-width: 60px;
    border: 1px solid var(--color-border);
    background-color: var(--color-accent);
    color: var(--color-text-inverse);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

    .iz-grid-button:hover {
        background-color: var(--color-accent-hover);
    }

.iz-grid-button-zero {
    margin: 0 auto;
    padding: 4px 8px;
    max-width: 60px;
    border: 1px solid var(--color-zero);
    background-color: transparent;
    color: var(--color-zero);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
}

.iz-treelist-button {
    margin: 0 auto;
    padding: 4px 0;
    max-width: 60px;
    color: var(--color-accent);
    cursor: pointer;
    transition: color var(--transition-fast);
}

    .iz-treelist-button:hover {
        text-decoration: underline;
        color: var(--color-accent-hover);
    }

/* ============================================
   20. Grid Row Delete Style
   ============================================ */

.iz-grid-delete-line {
    text-decoration: line-through var(--color-error) 2px;
}

.iz-grid-delete-none-line {
    text-decoration: none;
}

/* Grid A Button Style */
.iz-grid-a-bg-orange {
    background-color: var(--color-accent);
    color: var(--color-text-inverse) !important;
    border-radius: var(--radius-full);
    padding: 4px 12px;
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    transition: background-color var(--transition-fast);
}

    .iz-grid-a-bg-orange:hover {
        background-color: var(--color-accent-hover);
    }

/* ============================================
   21. Help & Misc
   ============================================ */

.iz-help-list {
    padding: 8px;
}

.iz-help-list-question {
    margin: 12px 0;
    padding: 12px;
    background-color: var(--color-bg-sunken);
    border-radius: var(--radius-md);
}

.iz-popup-button-group {
    display: flex;
    gap: 8px;
}

.iz-group-hidden {
    display: none;
}

/* Panel Fullscreen */
.panel-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: var(--z-modal) !important;
    border-radius: 0 !important;
}

/* 다크 모드 help & misc */
[data-theme="dark"] .iz-help-list-question,
html[data-theme="dark"] .iz-help-list-question,
body[data-theme="dark"] .iz-help-list-question {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}

/* ============================================
   22. With Footer Layout
   ============================================ */

.with-footer > div > div > .dx-scrollable-content {
    height: 100%;
}

    .with-footer > div > div > .dx-scrollable-content > .dx-scrollview-content {
        display: flex;
        flex-direction: column;
        min-height: 100%;
    }

/* ============================================
   23. 다크 모드 추가 스타일 (전역)
   ============================================ */

/* 다크 모드 레이아웃 헤더 */
[data-theme="dark"] .layout-header,
html[data-theme="dark"] .layout-header,
body[data-theme="dark"] .layout-header {
    background-color: #1e293b !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3) !important;
}

[data-theme="dark"] #maintoptoolbar,
html[data-theme="dark"] #maintoptoolbar,
body[data-theme="dark"] #maintoptoolbar {
    background-color: #1e293b !important;
}

/* 다크 모드 레이아웃 바디 */
[data-theme="dark"] .layout-body,
html[data-theme="dark"] .layout-body,
body[data-theme="dark"] .layout-body {
    background-color: #0f172a !important;
}

    /* 다크 모드 푸터 */
    [data-theme="dark"] .layout-body .content-footer,
    html[data-theme="dark"] .layout-body .content-footer,
    body[data-theme="dark"] .layout-body .content-footer {
        background-color: #1e293b !important;
        border-top-color: #334155 !important;
        color: #94a3b8 !important;
    }

/* 다크 모드 드로어 콘텐츠 */
[data-theme="dark"] .dx-drawer-content,
html[data-theme="dark"] .dx-drawer-content,
body[data-theme="dark"] .dx-drawer-content {
    background-color: #1e293b !important;
}

/* 다크 모드 스크롤바 */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

    [data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
        background: #64748b;
    }

/* ============================================
   24. Responsive Styles
   ============================================ */

/* Mobile (< 640px) */
@media screen and (max-width: 639px) {
    .layout-header {
        padding: 0 8px;
    }

    .top-logo-img > img {
        max-height: 24px;
        margin-left: 8px;
    }

    .top-logo-txt {
        display: none;
    }

    .layout-body .menu-container {
        width: 100%;
        min-width: 100%;
        position: fixed;
        z-index: var(--z-modal);
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

        .layout-body .menu-container.open {
            transform: translateX(0);
        }

    .tab-container-search {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }

    .iz_widget {
        width: 100%;
        justify-content: space-between;
    }

    .iz_widget-label {
        min-width: 80px;
    }

    .layout-body .content .iz-panel-userinfo {
        right: 8px;
        width: calc(100% - 16px);
        max-height: 60%;
    }

    .layout-body .content .iz-panel-right {
        right: 8px;
        width: calc(100% - 16px);
    }

    .iz-submenu {
        margin-left: 8px;
        overflow-x: auto;
    }

        .iz-submenu .dx-tabs-wrapper .dx-tab {
            min-width: 80px;
            padding: 0 12px;
        }

    .sw_darkmode {
        gap: 8px;
        font-size: var(--font-size-xs);
    }

    .layout-body .content-footer {
        flex-wrap: wrap;
        padding: 8px;
        gap: 8px;
    }

        .layout-body .content-footer .content-footer-message {
            width: 100%;
            order: 2;
        }

        .layout-body .content-footer .content-footer-copyright {
            width: 100%;
            margin-left: 0;
            text-align: center;
            order: 1;
        }
}

/* Tablet (640px - 1024px) */
@media screen and (min-width: 640px) and (max-width: 1023px) {
    .layout-body .menu-container {
        width: 220px;
        min-width: 220px;
    }

    .tab-container-search {
        gap: 12px;
        padding: 8px 12px;
    }

    .layout-body .content .iz-panel-userinfo {
        width: 280px;
    }

    .iz-submenu .dx-tabs-wrapper .dx-tab {
        min-width: 90px;
    }
}

/* Desktop (1024px - 1280px) */
@media screen and (min-width: 1024px) and (max-width: 1279px) {
    .layout-body .menu-container {
        width: 240px;
        min-width: 240px;
    }
}

/* Large Desktop (>= 1280px) */
@media screen and (min-width: 1280px) {
    .layout-body .menu-container {
        width: 260px;
        min-width: 260px;
    }

    .tab-container-search {
        gap: 20px;
        padding: 10px 20px;
    }
}

/* Extra Large Desktop (>= 1536px) */
@media screen and (min-width: 1536px) {
    .layout-body .menu-container {
        width: 280px;
        min-width: 280px;
    }

    .layout-header {
        padding: 0 24px;
    }

    .tab-container-search {
        gap: 24px;
        padding: 12px 24px;
    }
}

/* ============================================
   25. Print Styles
   ============================================ */

@media print {
    .layout-header,
    .menu-container,
    .content-footer,
    .iz-panel-right,
    .iz-panel-userinfo,
    .sw_darkmode,
    .btn-UserChange {
        display: none !important;
    }

    .layout-body {
        background-color: white !important;
    }

        .layout-body .content {
            width: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
        }

    .tab-container-search {
        background-color: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .dx-datagrid-headers .dx-datagrid-table .dx-row:not(.dx-datagrid-filter-row) > td {
        background-color: #333 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================
   26. Accessibility
   ============================================ */

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000000;
        --color-text-primary: #000000;
        --color-bg-surface: #ffffff;
    }

    [data-theme="dark"] {
        --color-border: #ffffff;
        --color-text-primary: #ffffff;
        --color-bg-surface: #000000;
    }
}

/* ============================================
   27. Smooth Theme Transition
   ============================================ */

/* Apply transition to theme-dependent elements */
.layout-header,
.layout-body,
.menu-container,
.content-footer,
.tab-container-search,
.popup-container-search,
.search-panel,
.iz-card,
.card,
.dx-popup-content,
.dx-accordion-item,
.dx-tab,
.dx-tabpanel .dx-tabs-wrapper,
.dx-drawer-content,
.dx-drawer-panel-content,
.iz-panel-userinfo,
.iz-panel-userinfo-header,
.iz-panel-userinfo-content,
.iz-panel-userinfo-contents,
.iz-panel-userinfo-bottom,
.iz-panel-right,
.iz-panel-right-title {
    transition: background-color var(--transition-slow), border-color var(--transition-slow), color var(--transition-slow), box-shadow var(--transition-slow);
}

/* 사용자 정보 패널 컨테이너 */
[data-theme="dark"] .iz-user-panel-container,
html[data-theme="dark"] .iz-user-panel-container,
body[data-theme="dark"] .iz-user-panel-container {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* 사용자 정보 패널 헤더 */
[data-theme="dark"] .iz-user-header,
html[data-theme="dark"] .iz-user-header,
body[data-theme="dark"] .iz-user-header {
    background-color: #334155 !important;
    border-bottom-color: #475569 !important;
}

[data-theme="dark"] .iz-user-header-title,
html[data-theme="dark"] .iz-user-header-title,
body[data-theme="dark"] .iz-user-header-title {
    color: #f1f5f9 !important;
}

/* 닫기 버튼 아이콘 */
[data-theme="dark"] .iz-user-header .dx-icon-close,
html[data-theme="dark"] .iz-user-header .dx-icon-close,
body[data-theme="dark"] .iz-user-header .dx-icon-close {
    color: #94a3b8 !important;
}

[data-theme="dark"] .iz-user-header .dx-button:hover .dx-icon-close,
html[data-theme="dark"] .iz-user-header .dx-button:hover .dx-icon-close,
body[data-theme="dark"] .iz-user-header .dx-button:hover .dx-icon-close {
    color: #f1f5f9 !important;
}

/* 프로필 섹션 */
[data-theme="dark"] .iz-user-profile-section,
html[data-theme="dark"] .iz-user-profile-section,
body[data-theme="dark"] .iz-user-profile-section {
    background-color: #0f172a !important;
    border-bottom-color: #475569 !important;
}

[data-theme="dark"] .iz-user-name-box,
html[data-theme="dark"] .iz-user-name-box,
body[data-theme="dark"] .iz-user-name-box {
    color: #f1f5f9 !important;
}

    [data-theme="dark"] .iz-user-name-box span,
    html[data-theme="dark"] .iz-user-name-box span,
    body[data-theme="dark"] .iz-user-name-box span {
        color: #94a3b8 !important;
    }

[data-theme="dark"] .iz-user-info-sub,
html[data-theme="dark"] .iz-user-info-sub,
body[data-theme="dark"] .iz-user-info-sub {
    color: #cbd5e1 !important;
}

    [data-theme="dark"] .iz-user-info-sub .dx-icon,
    html[data-theme="dark"] .iz-user-info-sub .dx-icon,
    body[data-theme="dark"] .iz-user-info-sub .dx-icon {
        color: #64748b !important;
    }

/* 섹션 그룹 */
[data-theme="dark"] .iz-section-group,
html[data-theme="dark"] .iz-section-group,
body[data-theme="dark"] .iz-section-group {
    background-color: #1e293b !important;
    border-bottom-color: #475569 !important;
}

[data-theme="dark"] .iz-section-title,
html[data-theme="dark"] .iz-section-title,
body[data-theme="dark"] .iz-section-title {
    color: #94a3b8 !important;
}

/* 푸터 액션 */
[data-theme="dark"] .iz-footer-action,
html[data-theme="dark"] .iz-footer-action,
body[data-theme="dark"] .iz-footer-action {
    background-color: #334155 !important;
    border-top-color: #475569 !important;
}

/* 배지 스타일 */
[data-theme="dark"] .iz-user-badge.normal,
html[data-theme="dark"] .iz-user-badge.normal,
body[data-theme="dark"] .iz-user-badge.normal {
    background-color: #60a5fa !important;
}

[data-theme="dark"] .iz-user-badge.master,
html[data-theme="dark"] .iz-user-badge.master,
body[data-theme="dark"] .iz-user-badge.master {
    background-color: #4ade80 !important;
}

/* ============================================
   2. DevExtreme 팝업/다이얼로그 다크 모드
   ============================================ */

/* 팝업 콘텐츠 */
[data-theme="dark"] .dx-popup-wrapper .dx-overlay-content,
html[data-theme="dark"] .dx-popup-wrapper .dx-overlay-content,
body[data-theme="dark"] .dx-popup-wrapper .dx-overlay-content {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .dx-popup-content,
html[data-theme="dark"] .dx-popup-content,
body[data-theme="dark"] .dx-popup-content {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* 팝업 타이틀바 (다크 모드에서도 그라데이션 유지) */
[data-theme="dark"] .dx-popup-title.dx-toolbar,
html[data-theme="dark"] .dx-popup-title.dx-toolbar,
body[data-theme="dark"] .dx-popup-title.dx-toolbar {
    background: linear-gradient(135deg, #334155 0%, #475569 100%) !important;
}

/* 팝업 하단 툴바 */
[data-theme="dark"] .dx-popup-bottom.dx-toolbar,
html[data-theme="dark"] .dx-popup-bottom.dx-toolbar,
body[data-theme="dark"] .dx-popup-bottom.dx-toolbar {
    background-color: #1e293b !important;
    border-top-color: #475569 !important;
}

/* 다이얼로그 */
[data-theme="dark"] .dx-dialog-wrapper .dx-overlay-content,
html[data-theme="dark"] .dx-dialog-wrapper .dx-overlay-content,
body[data-theme="dark"] .dx-dialog-wrapper .dx-overlay-content {
    background-color: #1e293b !important;
}

[data-theme="dark"] .dx-dialog-content,
html[data-theme="dark"] .dx-dialog-content,
body[data-theme="dark"] .dx-dialog-content {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-dialog-message,
html[data-theme="dark"] .dx-dialog-message,
body[data-theme="dark"] .dx-dialog-message {
    color: #f1f5f9 !important;
}

/* ============================================
   3. DevExtreme Form/Input 다크 모드
   ============================================ */

/* Form 전체 */
[data-theme="dark"] .dx-form,
html[data-theme="dark"] .dx-form,
body[data-theme="dark"] .dx-form {
    background-color: transparent !important;
}

/* 필드 라벨 */
[data-theme="dark"] .dx-field-item-label-text,
html[data-theme="dark"] .dx-field-item-label-text,
body[data-theme="dark"] .dx-field-item-label-text {
    color: #cbd5e1 !important;
}

/* TextEditor 공통 */
[data-theme="dark"] .dx-texteditor,
html[data-theme="dark"] .dx-texteditor,
body[data-theme="dark"] .dx-texteditor {
    background-color: #1e293b !important;
}

[data-theme="dark"] .dx-texteditor-input,
html[data-theme="dark"] .dx-texteditor-input,
body[data-theme="dark"] .dx-texteditor-input {
    color: #f1f5f9 !important;
    background-color: transparent !important;
}

/* Outlined 스타일 */
[data-theme="dark"] .dx-texteditor.dx-editor-outlined,
html[data-theme="dark"] .dx-texteditor.dx-editor-outlined,
body[data-theme="dark"] .dx-texteditor.dx-editor-outlined {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

/* Filled 스타일 */
[data-theme="dark"] .dx-texteditor.dx-editor-filled,
html[data-theme="dark"] .dx-texteditor.dx-editor-filled,
body[data-theme="dark"] .dx-texteditor.dx-editor-filled {
    background-color: #334155 !important;
}

/* Placeholder */
[data-theme="dark"] .dx-placeholder::before,
html[data-theme="dark"] .dx-placeholder::before,
body[data-theme="dark"] .dx-placeholder::before {
    color: #64748b !important;
}

/* Readonly 상태 */
[data-theme="dark"] .dx-state-readonly,
html[data-theme="dark"] .dx-state-readonly,
body[data-theme="dark"] .dx-state-readonly {
    background-color: #334155 !important;
}

    [data-theme="dark"] .dx-state-readonly .dx-texteditor-input,
    html[data-theme="dark"] .dx-state-readonly .dx-texteditor-input,
    body[data-theme="dark"] .dx-state-readonly .dx-texteditor-input {
        color: rgba(255, 255, 255, 0.7) !important;
    }

/* Required 필드 배경 */
[data-theme="dark"] .dx-field-item.dx-field-item-required > .dx-field-item-content > .dx-show-invalid-badge:not(.dx-htmleditor),
html[data-theme="dark"] .dx-field-item.dx-field-item-required > .dx-field-item-content > .dx-show-invalid-badge:not(.dx-htmleditor),
body[data-theme="dark"] .dx-field-item.dx-field-item-required > .dx-field-item-content > .dx-show-invalid-badge:not(.dx-htmleditor) {
    background-color: #334155 !important;
}

/* ============================================
   4. DevExtreme 버튼 다크 모드
   ============================================ */

/* Contained 버튼 */
[data-theme="dark"] .dx-button-mode-contained,
html[data-theme="dark"] .dx-button-mode-contained,
body[data-theme="dark"] .dx-button-mode-contained {
    background-color: #475569 !important;
    color: #f1f5f9 !important;
}

    [data-theme="dark"] .dx-button-mode-contained.dx-state-hover,
    html[data-theme="dark"] .dx-button-mode-contained.dx-state-hover,
    body[data-theme="dark"] .dx-button-mode-contained.dx-state-hover {
        background-color: #64748b !important;
    }

/* Outlined 버튼 */
[data-theme="dark"] .dx-button-mode-outlined,
html[data-theme="dark"] .dx-button-mode-outlined,
body[data-theme="dark"] .dx-button-mode-outlined {
    border-color: #64748b !important;
    color: #f1f5f9 !important;
    background-color: #334155 !important;
}

    [data-theme="dark"] .dx-button-mode-outlined.dx-state-hover,
    html[data-theme="dark"] .dx-button-mode-outlined.dx-state-hover,
    body[data-theme="dark"] .dx-button-mode-outlined.dx-state-hover {
        background-color: #475569 !important;
    }

/* Text 버튼 */
[data-theme="dark"] .dx-button-mode-text,
html[data-theme="dark"] .dx-button-mode-text,
body[data-theme="dark"] .dx-button-mode-text {
    color: #f1f5f9 !important;
}

/* Default 타입 버튼 (오렌지) */
[data-theme="dark"] .dx-button.dx-button-default,
html[data-theme="dark"] .dx-button.dx-button-default,
body[data-theme="dark"] .dx-button.dx-button-default {
    background-color: #fb923c !important;
}

/* Danger 타입 버튼 */
[data-theme="dark"] .dx-button.dx-button-danger,
html[data-theme="dark"] .dx-button.dx-button-danger,
body[data-theme="dark"] .dx-button.dx-button-danger {
    background-color: #f87171 !important;
}

/* Success 타입 버튼 */
[data-theme="dark"] .dx-button.dx-button-success,
html[data-theme="dark"] .dx-button.dx-button-success,
body[data-theme="dark"] .dx-button.dx-button-success {
    background-color: #4ade80 !important;
}

/* 버튼 아이콘 */
[data-theme="dark"] .dx-button .dx-icon,
html[data-theme="dark"] .dx-button .dx-icon,
body[data-theme="dark"] .dx-button .dx-icon {
    color: inherit !important;
}

/* ============================================
   5. DevExtreme SelectBox/DropDown 다크 모드
   ============================================ */

/* DropDown 아이콘 */
[data-theme="dark"] .dx-dropdowneditor-icon,
html[data-theme="dark"] .dx-dropdowneditor-icon,
body[data-theme="dark"] .dx-dropdowneditor-icon {
    color: #94a3b8 !important;
}

[data-theme="dark"] .dx-dropdowneditor.dx-state-hover .dx-dropdowneditor-icon,
html[data-theme="dark"] .dx-dropdowneditor.dx-state-hover .dx-dropdowneditor-icon,
body[data-theme="dark"] .dx-dropdowneditor.dx-state-hover .dx-dropdowneditor-icon {
    color: #f1f5f9 !important;
}

/* DropDown 팝업 */
[data-theme="dark"] .dx-dropdownlist-popup-wrapper .dx-overlay-content,
html[data-theme="dark"] .dx-dropdownlist-popup-wrapper .dx-overlay-content,
body[data-theme="dark"] .dx-dropdownlist-popup-wrapper .dx-overlay-content {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

/* List 아이템 */
[data-theme="dark"] .dx-list-item,
html[data-theme="dark"] .dx-list-item,
body[data-theme="dark"] .dx-list-item {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

    [data-theme="dark"] .dx-list-item.dx-state-hover,
    html[data-theme="dark"] .dx-list-item.dx-state-hover,
    body[data-theme="dark"] .dx-list-item.dx-state-hover {
        background-color: #334155 !important;
    }

    [data-theme="dark"] .dx-list-item.dx-state-focused,
    html[data-theme="dark"] .dx-list-item.dx-state-focused,
    body[data-theme="dark"] .dx-list-item.dx-state-focused {
        background-color: #334155 !important;
    }

    [data-theme="dark"] .dx-list-item.dx-list-item-selected,
    html[data-theme="dark"] .dx-list-item.dx-list-item-selected,
    body[data-theme="dark"] .dx-list-item.dx-list-item-selected {
        background-color: #0c4a6e !important;
    }

/* ============================================
   6. DevExtreme Toolbar 다크 모드
   ============================================ */

[data-theme="dark"] .dx-toolbar,
html[data-theme="dark"] .dx-toolbar,
body[data-theme="dark"] .dx-toolbar {
    background-color: #1e293b !important;
}

/* ============================================
   7. DevExtreme Checkbox/RadioButton 다크 모드
   ============================================ */

[data-theme="dark"] .dx-checkbox-text,
html[data-theme="dark"] .dx-checkbox-text,
body[data-theme="dark"] .dx-checkbox-text {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-radiobutton-text,
html[data-theme="dark"] .dx-radiobutton-text,
body[data-theme="dark"] .dx-radiobutton-text {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-checkbox-icon,
html[data-theme="dark"] .dx-checkbox-icon,
body[data-theme="dark"] .dx-checkbox-icon {
    border-color: #64748b !important;
}

[data-theme="dark"] .dx-radiobutton-icon,
html[data-theme="dark"] .dx-radiobutton-icon,
body[data-theme="dark"] .dx-radiobutton-icon {
    border-color: #64748b !important;
}

/* ============================================
   8. DevExtreme Switch 다크 모드
   ============================================ */

[data-theme="dark"] .dx-switch-off .dx-switch-container,
html[data-theme="dark"] .dx-switch-off .dx-switch-container,
body[data-theme="dark"] .dx-switch-off .dx-switch-container {
    background-color: #475569 !important;
}

/* ============================================
   9. DevExtreme DataGrid 다크 모드 보강
   ============================================ */

/* 그리드 헤더 */
[data-theme="dark"] .dx-datagrid-headers .dx-datagrid-table .dx-row:not(.dx-datagrid-filter-row) > td,
html[data-theme="dark"] .dx-datagrid-headers .dx-datagrid-table .dx-row:not(.dx-datagrid-filter-row) > td,
body[data-theme="dark"] .dx-datagrid-headers .dx-datagrid-table .dx-row:not(.dx-datagrid-filter-row) > td {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-right-color: #475569 !important;
}

/* 그리드 로우 */
[data-theme="dark"] .dx-datagrid-rowsview .dx-row,
html[data-theme="dark"] .dx-datagrid-rowsview .dx-row,
body[data-theme="dark"] .dx-datagrid-rowsview .dx-row {
    background-color: #1e293b !important;
}

[data-theme="dark"] .dx-datagrid-rowsview .dx-row-alt,
html[data-theme="dark"] .dx-datagrid-rowsview .dx-row-alt,
body[data-theme="dark"] .dx-datagrid-rowsview .dx-row-alt {
    background-color: #263445 !important;
}

[data-theme="dark"] .dx-datagrid .dx-row > td,
html[data-theme="dark"] .dx-datagrid .dx-row > td,
body[data-theme="dark"] .dx-datagrid .dx-row > td {
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* 그리드 로우 선택 */
[data-theme="dark"] .dx-datagrid-rowsview .dx-selection.dx-row:not(.dx-row-focused) > td,
html[data-theme="dark"] .dx-datagrid-rowsview .dx-selection.dx-row:not(.dx-row-focused) > td,
body[data-theme="dark"] .dx-datagrid-rowsview .dx-selection.dx-row:not(.dx-row-focused) > td {
    background-color: #0c4a6e !important;
}

/* 그리드 로우 호버 */
[data-theme="dark"] .dx-datagrid-rowsview .dx-row:not(.dx-selection):hover > td,
html[data-theme="dark"] .dx-datagrid-rowsview .dx-row:not(.dx-selection):hover > td,
body[data-theme="dark"] .dx-datagrid-rowsview .dx-row:not(.dx-selection):hover > td {
    background-color: #334155 !important;
}

/* 그리드 필터 로우 */
[data-theme="dark"] .dx-datagrid-filter-row,
html[data-theme="dark"] .dx-datagrid-filter-row,
body[data-theme="dark"] .dx-datagrid-filter-row {
    background-color: #1e293b !important;
}

/* 그리드 페이저 */
[data-theme="dark"] .dx-datagrid-pager,
html[data-theme="dark"] .dx-datagrid-pager,
body[data-theme="dark"] .dx-datagrid-pager {
    background-color: #1e293b !important;
    border-top-color: #475569 !important;
}

/* 그리드 noDataText */
[data-theme="dark"] .dx-datagrid-nodata,
html[data-theme="dark"] .dx-datagrid-nodata,
body[data-theme="dark"] .dx-datagrid-nodata {
    color: #64748b !important;
}

/* ============================================
   10. DevExtreme TabPanel 다크 모드 보강
   ============================================ */

[data-theme="dark"] .dx-tabpanel .dx-tabs-wrapper,
html[data-theme="dark"] .dx-tabpanel .dx-tabs-wrapper,
body[data-theme="dark"] .dx-tabpanel .dx-tabs-wrapper {
    background-color: #334155 !important;
}

[data-theme="dark"] .dx-tabpanel .dx-tab:not(.dx-tab-selected):not(.dx-state-hover),
html[data-theme="dark"] .dx-tabpanel .dx-tab:not(.dx-tab-selected):not(.dx-state-hover),
body[data-theme="dark"] .dx-tabpanel .dx-tab:not(.dx-tab-selected):not(.dx-state-hover) {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-tab.dx-tab-selected,
html[data-theme="dark"] .dx-tab.dx-tab-selected,
body[data-theme="dark"] .dx-tab.dx-tab-selected {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-tab.dx-state-hover,
html[data-theme="dark"] .dx-tab.dx-state-hover,
body[data-theme="dark"] .dx-tab.dx-state-hover {
    background-color: #475569 !important;
}

/* ============================================
   11. Scrollbar 다크 모드
   ============================================ */

[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

    [data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
        background: #64748b;
    }

/* ============================================
   12. 기타 다크 모드 스타일
   ============================================ */

/* LoadPanel */
[data-theme="dark"] .dx-loadpanel-content,
html[data-theme="dark"] .dx-loadpanel-content,
body[data-theme="dark"] .dx-loadpanel-content {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* Tooltip */
[data-theme="dark"] .dx-tooltip-wrapper .dx-overlay-content,
html[data-theme="dark"] .dx-tooltip-wrapper .dx-overlay-content,
body[data-theme="dark"] .dx-tooltip-wrapper .dx-overlay-content {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* Context Menu */
[data-theme="dark"] .dx-context-menu .dx-overlay-content,
html[data-theme="dark"] .dx-context-menu .dx-overlay-content,
body[data-theme="dark"] .dx-context-menu .dx-overlay-content {
    background-color: #1e293b !important;
}

[data-theme="dark"] .dx-context-menu .dx-menu-item,
html[data-theme="dark"] .dx-context-menu .dx-menu-item,
body[data-theme="dark"] .dx-context-menu .dx-menu-item {
    color: #f1f5f9 !important;
}

    [data-theme="dark"] .dx-context-menu .dx-menu-item.dx-state-hover,
    html[data-theme="dark"] .dx-context-menu .dx-menu-item.dx-state-hover,
    body[data-theme="dark"] .dx-context-menu .dx-menu-item.dx-state-hover {
        background-color: #334155 !important;
    }

/* Calendar */
[data-theme="dark"] .dx-calendar,
html[data-theme="dark"] .dx-calendar,
body[data-theme="dark"] .dx-calendar {
    background-color: #1e293b !important;
}

[data-theme="dark"] .dx-calendar-cell,
html[data-theme="dark"] .dx-calendar-cell,
body[data-theme="dark"] .dx-calendar-cell {
    color: #f1f5f9 !important;
}

    [data-theme="dark"] .dx-calendar-cell.dx-calendar-other-month,
    html[data-theme="dark"] .dx-calendar-cell.dx-calendar-other-month,
    body[data-theme="dark"] .dx-calendar-cell.dx-calendar-other-month {
        color: #64748b !important;
    }

/* Accordion */
[data-theme="dark"] .dx-accordion-item,
html[data-theme="dark"] .dx-accordion-item,
body[data-theme="dark"] .dx-accordion-item {
    border-color: #475569 !important;
}

[data-theme="dark"] .dx-accordion-item-title,
html[data-theme="dark"] .dx-accordion-item-title,
body[data-theme="dark"] .dx-accordion-item-title {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .dx-accordion-item-opened > .dx-accordion-item-title,
html[data-theme="dark"] .dx-accordion-item-opened > .dx-accordion-item-title,
body[data-theme="dark"] .dx-accordion-item-opened > .dx-accordion-item-title {
    background-color: #334155 !important;
    border-bottom-color: #475569 !important;
}

[data-theme="dark"] .dx-accordion-item-body,
html[data-theme="dark"] .dx-accordion-item-body,
body[data-theme="dark"] .dx-accordion-item-body {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* ============================================
   사이드바 기본 스타일 (항상 어두운 배경 + 밝은 텍스트)
   ============================================ */

.layout-body .menu-container {
    background-color: var(--sidebar-bg) !important;
}

.menu-container .dx-widget {
    color: var(--sidebar-text) !important;
}

.menu-container .dx-treeview .dx-treeview-item {
    color: var(--sidebar-text) !important;
}

.menu-container .dx-treeview .dx-treeview-item-content {
    color: var(--sidebar-text) !important;
}

.menu-container .dx-treeview .dx-treeview-item.dx-state-hover {
    color: var(--sidebar-text-hover) !important;
    background-color: var(--sidebar-bg-hover) !important;
}

.menu-container .dx-treeview .dx-treeview-item .dx-icon {
    color: var(--sidebar-icon) !important;
}

.menu-container .dx-treeview .dx-treeview-node[aria-level="1"] .dx-treeview-item-content,
.menu-container .dx-treeview .dx-treeview-node[aria-level="2"] .dx-treeview-item-content,
.menu-container .dx-treeview .dx-treeview-node[aria-level="3"] .dx-treeview-item-content,
.menu-container .dx-treeview .dx-treeview-node[aria-level="4"] .dx-treeview-item-content {
    color: var(--sidebar-text) !important;
}

#mainmenutree .dx-placeholder {
    color: var(--sidebar-text-muted) !important;
}

    #mainmenutree .dx-placeholder::before {
        color: var(--sidebar-text-muted) !important;
    }

#mainmenutree .dx-texteditor-input {
    color: var(--sidebar-text) !important;
}

#mainmenutree .dx-icon-search:before {
    color: var(--sidebar-text) !important;
}

#sysmenu .dx-button-content,
#sysmenu .dx-button-text {
    color: var(--sidebar-text) !important;
}

#sysmenu .dx-icon-preferences,
#sysmenu .dx-icon-spindown {
    color: var(--sidebar-text) !important;
}

.mainmenutree-logo {
    color: var(--sidebar-text-muted);
    border-top-color: var(--sidebar-border);
}

/* ============================================
   다크모드에서도 사이드바 스타일 유지
   ============================================ */

[data-theme="dark"] .layout-body .menu-container,
html[data-theme="dark"] .layout-body .menu-container,
body[data-theme="dark"] .layout-body .menu-container,
.dark-mode .layout-body .menu-container {
    background-color: #1e293b !important;
}

[data-theme="dark"] .menu-container .dx-widget,
html[data-theme="dark"] .menu-container .dx-widget,
body[data-theme="dark"] .menu-container .dx-widget,
.dark-mode .menu-container .dx-widget {
    color: #ffffff !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item,
.dark-mode .menu-container .dx-treeview .dx-treeview-item {
    color: #ffffff !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item-content,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item-content,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item-content,
.dark-mode .menu-container .dx-treeview .dx-treeview-item-content {
    color: #ffffff !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item .dx-icon,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item .dx-icon,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item .dx-icon,
.dark-mode .menu-container .dx-treeview .dx-treeview-item .dx-icon {
    color: #ffffff !important;
}

[data-theme="dark"] #mainmenutree .dx-texteditor-input,
html[data-theme="dark"] #mainmenutree .dx-texteditor-input,
body[data-theme="dark"] #mainmenutree .dx-texteditor-input,
.dark-mode #mainmenutree .dx-texteditor-input {
    color: #ffffff !important;
}

[data-theme="dark"] #mainmenutree .dx-placeholder,
html[data-theme="dark"] #mainmenutree .dx-placeholder,
body[data-theme="dark"] #mainmenutree .dx-placeholder,
.dark-mode #mainmenutree .dx-placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

    [data-theme="dark"] #mainmenutree .dx-placeholder::before,
    html[data-theme="dark"] #mainmenutree .dx-placeholder::before,
    body[data-theme="dark"] #mainmenutree .dx-placeholder::before,
    .dark-mode #mainmenutree .dx-placeholder::before {
        color: rgba(255, 255, 255, 0.6) !important;
    }

[data-theme="dark"] #mainmenutree .dx-icon-search:before,
html[data-theme="dark"] #mainmenutree .dx-icon-search:before,
body[data-theme="dark"] #mainmenutree .dx-icon-search:before,
.dark-mode #mainmenutree .dx-icon-search:before {
    color: #ffffff !important;
}

[data-theme="dark"] #sysmenu .dx-button-content,
[data-theme="dark"] #sysmenu .dx-button-text,
html[data-theme="dark"] #sysmenu .dx-button-content,
html[data-theme="dark"] #sysmenu .dx-button-text,
body[data-theme="dark"] #sysmenu .dx-button-content,
body[data-theme="dark"] #sysmenu .dx-button-text,
.dark-mode #sysmenu .dx-button-content,
.dark-mode #sysmenu .dx-button-text {
    color: #ffffff !important;
}

[data-theme="dark"] #sysmenu .dx-icon-preferences,
[data-theme="dark"] #sysmenu .dx-icon-spindown,
html[data-theme="dark"] #sysmenu .dx-icon-preferences,
html[data-theme="dark"] #sysmenu .dx-icon-spindown,
body[data-theme="dark"] #sysmenu .dx-icon-preferences,
body[data-theme="dark"] #sysmenu .dx-icon-spindown,
.dark-mode #sysmenu .dx-icon-preferences,
.dark-mode #sysmenu .dx-icon-spindown {
    color: #ffffff !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node[aria-level="1"] .dx-treeview-item-content,
[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node[aria-level="2"] .dx-treeview-item-content,
[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node[aria-level="3"] .dx-treeview-item-content,
[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node[aria-level="4"] .dx-treeview-item-content,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content,
.dark-mode .menu-container .dx-treeview .dx-treeview-node .dx-treeview-item-content {
    color: #ffffff !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected > .dx-treeview-item *,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected > .dx-treeview-item *,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected > .dx-treeview-item *,
.dark-mode .menu-container .dx-treeview .dx-treeview-node-container .dx-treeview-node.dx-state-selected > .dx-treeview-item * {
    color: #fb923c !important;
}

[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item.dx-state-hover,
html[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item.dx-state-hover,
body[data-theme="dark"] .menu-container .dx-treeview .dx-treeview-item.dx-state-hover,
.dark-mode .menu-container .dx-treeview .dx-treeview-item.dx-state-hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

[data-theme="dark"] #mainmenutree .dx-treeview-node-container .dx-treeview-node .dx-treeview-node-container-opened,
html[data-theme="dark"] #mainmenutree .dx-treeview-node-container .dx-treeview-node .dx-treeview-node-container-opened,
body[data-theme="dark"] #mainmenutree .dx-treeview-node-container .dx-treeview-node .dx-treeview-node-container-opened,
.dark-mode #mainmenutree .dx-treeview-node-container .dx-treeview-node .dx-treeview-node-container-opened {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .mainmenutree-logo,
html[data-theme="dark"] .mainmenutree-logo,
body[data-theme="dark"] .mainmenutree-logo,
.dark-mode .mainmenutree-logo {
    color: rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   다크모드 text-inverse 보정 (중요!)
   다크모드에서 text-inverse가 어두운 색으로 변경되는 것을 방지
   ============================================ */

/* 다크모드에서도 사이드바 관련 요소는 항상 밝은 텍스트 유지 */
[data-theme="dark"] .dx-drawer-panel-content,
html[data-theme="dark"] .dx-drawer-panel-content,
body[data-theme="dark"] .dx-drawer-panel-content {
    background-color: #1e293b !important;
}

    [data-theme="dark"] .dx-drawer-panel-content *,
    html[data-theme="dark"] .dx-drawer-panel-content *,
    body[data-theme="dark"] .dx-drawer-panel-content * {
        color: #ffffff;
    }

    /* 선택된 메뉴 아이템은 액센트 색상으로 */
    [data-theme="dark"] .dx-drawer-panel-content .dx-state-selected *,
    html[data-theme="dark"] .dx-drawer-panel-content .dx-state-selected *,
    body[data-theme="dark"] .dx-drawer-panel-content .dx-state-selected * {
        color: #fb923c !important;
    }

/* ============================================
   SYSMENU (EBUY) 높이 일관성 - 다크/라이트 모드 동일
   ============================================ */

:root {
    /* sysmenu 고정 높이 */
    --sysmenu-height: 48px;
    --sysmenu-bg: #0ea5e9;
}

/* sysmenu 컨테이너 - 고정 높이 */
#sysmenu {
    height: var(--sysmenu-height) !important;
    min-height: var(--sysmenu-height) !important;
    max-height: var(--sysmenu-height) !important;
    background-color: var(--sysmenu-bg) !important;
    display: flex !important;
    align-items: center !important;
}

    /* sysmenu 내부 버튼 - 높이 일관성 */
    #sysmenu .dx-buttongroup,
    #sysmenu .dx-buttongroup-wrapper,
    #sysmenu .dx-buttongroup-item,
    #sysmenu .dx-button {
        height: var(--sysmenu-height) !important;
        min-height: var(--sysmenu-height) !important;
        max-height: var(--sysmenu-height) !important;
    }

    #sysmenu .dx-button-content {
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 16px !important;
    }

    /* sysmenu 텍스트/아이콘 색상 - 항상 흰색 (다크모드 영향 없음) */
    #sysmenu,
    #sysmenu .dx-button,
    #sysmenu .dx-button-content,
    #sysmenu .dx-button-text,
    #sysmenu .dx-icon,
    #sysmenu .dx-icon-preferences,
    #sysmenu .dx-icon-spindown {
        color: #ffffff !important;
    }

/* 다크모드에서도 sysmenu 스타일 유지 */
[data-theme="dark"] #sysmenu,
html[data-theme="dark"] #sysmenu,
body[data-theme="dark"] #sysmenu,
.dark #sysmenu {
    background-color: var(--sysmenu-bg) !important;
}

    [data-theme="dark"] #sysmenu .dx-button-content,
    [data-theme="dark"] #sysmenu .dx-button-text,
    [data-theme="dark"] #sysmenu .dx-icon,
    html[data-theme="dark"] #sysmenu .dx-button-content,
    html[data-theme="dark"] #sysmenu .dx-button-text,
    html[data-theme="dark"] #sysmenu .dx-icon,
    .dark #sysmenu .dx-button-content,
    .dark #sysmenu .dx-button-text,
    .dark #sysmenu .dx-icon {
        color: #ffffff !important;
    }

/* DevExtreme 다크테마 기본 스타일 오버라이드 */
.dx-theme-material-typography #sysmenu .dx-button-text,
.dx-theme-material #sysmenu .dx-button-content {
    color: #ffffff !important;
}

/* ============================================
   모바일 반응형
   ============================================ */

/* 태블릿 (1024px 이하) */
@media (max-width: 1024px) {
    .layout-body .menu-container {
        width: 240px;
        min-width: 240px;
    }

    .iz-panel-userinfo,
    .iz-panel-right {
        width: 320px !important;
        min-width: 280px !important;
    }
}

/* 소형 태블릿 (768px 이하) */
@media (max-width: 768px) {
    :root {
        --sysmenu-height: 44px;
    }

    .layout-body .menu-container {
        width: 220px;
        min-width: 220px;
    }

    .layout-header {
        padding: 0 12px;
    }

    .top-logo {
        min-width: 160px;
        gap: 8px;
    }

    .top-logo-img > img {
        max-height: 28px;
        margin-left: 8px;
    }

    .top-logo-txt {
        font-size: 14px;
    }

    .iz-panel-userinfo,
    .iz-panel-right {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: unset !important;
    }
}

/* 모바일 (640px 이하) */
@media (max-width: 640px) {
    :root {
        --sysmenu-height: 40px;
    }

    /* 사이드바를 absolute로 변경 */
    .layout-body .menu-container {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        min-width: 260px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

        .layout-body .menu-container.menu-open {
            transform: translateX(0);
        }

    /* 콘텐츠 영역 전체 너비 사용 */
    .layout-body .content {
        width: 100%;
        margin-left: 0;
    }

    .layout-header {
        padding: 0 8px;
    }

    .top-logo {
        min-width: 120px;
        gap: 6px;
    }

    .top-logo-img > img {
        max-height: 24px;
        margin-left: 4px;
    }

    .top-logo-txt {
        font-size: 13px;
    }

    /* 우측 패널 하단 고정 */
    .iz-panel-userinfo,
    .iz-panel-right {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 70vh !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important;
    }

    /* 푸터 높이 조정 */
    .layout-body .content-footer {
        min-height: 32px;
        padding: 0 8px;
        font-size: 10px;
    }
}

/* 초소형 모바일 (480px 이하) */
@media (max-width: 480px) {
    :root {
        --sysmenu-height: 36px;
    }

    .layout-header {
        padding: 0 4px;
    }

    .top-logo {
        min-width: 100px;
    }

    .top-logo-img > img {
        max-height: 20px;
    }

    .top-logo-txt {
        font-size: 12px;
    }

    #sysmenu .dx-button-content {
        padding: 0 8px !important;
        font-size: 12px;
    }

    .layout-body .content-footer {
        flex-direction: column;
        gap: 4px;
        padding: 4px 8px;
        min-height: 40px;
    }

        .layout-body .content-footer .content-footer-message,
        .layout-body .content-footer .content-footer-copyright {
            width: 100%;
            text-align: center;
        }
}

/* 메뉴 오버레이 (모바일용) */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 640px) {
    .menu-overlay.active {
        display: block;
    }
}

/*

*/

/* ═══════════════════════════════════════════════════════════════════ */
/* 플로팅 채팅 버튼 (작게 수정) */
/* ═══════════════════════════════════════════════════════════════════ */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99990;
    transition: all 0.3s ease;
    border: none;
}

    .chat-fab:hover {
        transform: scale(1.1);
        box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
    }

.chat-fab-icon {
    font-size: 20px;
    color: white;
}

/* 관리자 상태 표시 (초록/회색) */
.chat-fab-status {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background: #aaa; /* 기본: 오프라인(회색) */
    transition: background 0.3s;
}

    .chat-fab-status.online {
        background: #51cf66; /* 온라인: 초록 */
    }

/* 읽지 않은 메시지 배지 */
.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

    .chat-fab-badge.show {
        display: flex;
    }

/* ═══════════════════════════════════════════════════════════════════ */
/* 채팅창 */
/* ═══════════════════════════════════════════════════════════════════ */
.chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 99991;
    overflow: hidden;
}

    .chat-window.open {
        display: flex;
        animation: chatSlideUp 0.3s ease;
    }

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 채팅 헤더 */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .chat-header-status .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #aaa;
    }

        .chat-header-status .dot.online {
            background: #51cf66;
        }

.chat-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

    .chat-close-btn:hover {
        background: rgba(255,255,255,0.3);
    }

/* 관리자 부재 안내 */
.chat-offline-notice {
    background: #fff3cd;
    color: #856404;
    padding: 10px 12px;
    font-size: 12px;
    text-align: center;
    display: none;
    border-bottom: 1px solid #ffeeba;
}

    .chat-offline-notice.show {
        display: block;
    }

/* 채팅 메시지 영역 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 메시지 버블 */
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

    .chat-bubble.user {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        align-self: flex-end;
        border-bottom-right-radius: 4px;
    }

    .chat-bubble.admin {
        background: white;
        color: #333;
        align-self: flex-start;
        border-bottom-left-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

.chat-bubble-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-bubble.user .chat-bubble-time {
    text-align: right;
}

/* 시스템 메시지 */
.chat-system-msg {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 6px;
}

/* 환영 메시지 */
.chat-welcome {
    text-align: center;
    padding: 30px 15px;
}

.chat-welcome-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.chat-welcome-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.chat-welcome-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* 입력 영역 */
.chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    resize: none;
    max-height: 80px;
    min-height: 38px;
    font-family: inherit;
}

    .chat-input:focus {
        border-color: #667eea;
    }

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .chat-send-btn:hover {
        transform: scale(1.05);
    }

    .chat-send-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

/* 모바일 대응 */
@media (max-width: 480px) {
    .chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-fab {
        bottom: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
    }
}