.dxgrid {
    --dx-border: #e5eaef;
    --dx-header-bg: #f7f9fc;
    --dx-header-bg2: #eef2f9;
    --dx-accent: #5d87ff;
    --dx-accent-soft: #ecf2ff;
    --dx-row-alt: #fafbfe;
    --dx-text: #2a3547;
    font-family: inherit;
    font-size: 13px;
    color: var(--dx-text);
    border: 1px solid var(--dx-border);
    border-radius: 9px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(45,53,71,.08);
    user-select: none;
}

/* ───── 높이 채움(Fill) 모드 ───── */
.dxgrid.is-fill { display: flex; flex-direction: column; height: 100%; }
.dxgrid.is-fill .dxgrid-toolbar,
.dxgrid.is-fill .dxgrid-grouppanel,
.dxgrid.is-fill .dxgrid-pager { flex: 0 0 auto; }
.dxgrid.is-fill .dxgrid-scroll { flex: 1 1 auto; min-height: 0; }

/* ───── 툴바 ───── */
.dxgrid-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid var(--dx-border);
}
.dxgrid-toolbar-spacer { flex: 1; }
.dxgrid-toolbar-check {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: #5a6a85; cursor: pointer; user-select: none;
    padding: 4px 6px;
}
.dxgrid-toolbar-check input { cursor: pointer; }
.dxgrid-recordcount { font-size: 12px; color: #5a6a85; font-weight: 600; }

.dxbtn {
    border: 1px solid var(--dx-border);
    background: #fff;
    border-radius: 7px;
    padding: 5px 11px;
    font-size: 12px;
    cursor: pointer;
    color: #5a6a85;
    transition: background .12s, border-color .12s, color .12s;
}
.dxbtn:hover { border-color: var(--dx-accent); background: var(--dx-accent-soft); color: var(--dx-accent); }
.dxbtn:disabled { opacity: .5; cursor: default; }
.dxbtn-sm { padding: 2px 8px; font-size: 11px; }
.dxbtn-primary { color: #fff; background: var(--dx-accent); border-color: var(--dx-accent); }
.dxbtn-primary:hover { background: #4570ea; color: #fff; }
.dxbtn-danger { color: #b91c1c; }
.dxbtn-danger:hover:not(:disabled) { background: #fdecec; border-color: #e08585; }
.dxbtn-danger-solid { color: #fff; background: linear-gradient(#ef4444, #dc2626); border-color: #dc2626; }
.dxbtn-danger-solid:hover { background: linear-gradient(#f15656, #e02b2b); }

/* ───── 열 선택 ───── */
.dxgrid-colchooser {
    position: absolute;
    z-index: 30;
    margin: 2px 8px;
    background: #fff;
    border: 1px solid var(--dx-border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(45,53,71,.16);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.dxgrid-colchooser-title { font-weight: 700; font-size: 12px; margin-bottom: 4px; color: #5a6a85; }
.dxgrid-colchooser-item { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }

/* ───── 그룹 패널 ───── */
.dxgrid-grouppanel {
    min-height: 38px;
    padding: 7px 12px;
    background: #f7f9fc;
    border-bottom: 1px solid var(--dx-border);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.dxgrid-grouppanel-hint { color: #7c8fac; font-size: 12px; font-style: italic; }
.dxgrid-groupchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dx-accent-soft);
    border: 1px solid var(--dx-accent);
    color: var(--dx-accent);
    border-radius: 14px;
    padding: 3px 6px 3px 12px;
    font-size: 12px; font-weight: 600;
}
.dxgrid-groupchip button {
    border: none; background: rgba(93,135,255,.25); color: var(--dx-accent);
    border-radius: 50%; width: 16px; height: 16px; line-height: 14px;
    font-size: 10px; cursor: pointer; padding: 0;
}
.dxgrid-groupchip button:hover { background: #fa896b; color: #fff; }

/* ───── 스크롤/테이블 ───── */
.dxgrid-scroll { overflow: auto; }
.dxgrid-table { width: max-content; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.dxgrid-table.is-fill { width: 100%; min-width: 100%; table-layout: auto; }

.dxgrid-table thead th,
.dxgrid-table tbody td,
.dxgrid-table tfoot td {
    padding: 9px 10px;
    border-bottom: 1px solid #f1f4f8;
    border-right: 1px solid #f4f6fa;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 헤더 */
.dxgrid-header th {
    position: sticky; top: 0; z-index: 5;
    background: linear-gradient(var(--dx-header-bg), var(--dx-header-bg2));
    font-weight: 700;
    color: #5a6a85;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--dx-border);
}
.dxgrid-th { position: relative; }
.dxgrid-th-cmd { cursor: default; text-align: center; }
.dxgrid-th:hover .dxgrid-th-text { color: var(--dx-accent); }
.dxgrid-th-text { display: inline-block; vertical-align: middle; }
.dxgrid-sort { display: inline-flex; align-items: center; gap: 2px; color: var(--dx-accent); margin-left: 5px; vertical-align: middle; }
.dxgrid-sort sup { font-size: 8px; }

.dxgrid-arrow { display: inline-block; width: 0; height: 0; border-style: solid; }
.dxgrid-arrow.is-up {
    border-width: 0 4px 6px 4px;
    border-color: transparent transparent var(--dx-accent) transparent;
}
.dxgrid-arrow.is-down {
    border-width: 6px 4px 0 4px;
    border-color: var(--dx-accent) transparent transparent transparent;
}

.dxgrid-resizer {
    position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
    cursor: col-resize; z-index: 6;
}

/* 필터 행 */
.dxgrid-filterrow td {
    position: sticky; top: 36px; z-index: 4;
    background: #fcfdfe; padding: 4px 6px;
    border-bottom: 1px solid var(--dx-border);
}
.dxgrid-filterwrap { display: flex; gap: 3px; align-items: center; }
.dxgrid-filterop {
    border: 1px solid var(--dx-border); border-radius: 5px; background: #f4f6fa;
    font-size: 10px; padding: 3px 1px; max-width: 48px; cursor: pointer;
}
.dxgrid-filterinput {
    flex: 1; min-width: 0; width: 100%;
    border: 1px solid var(--dx-border); border-radius: 5px; padding: 4px 7px; font-size: 12px;
}
.dxgrid-filterinput:focus, .dxgrid-filterop:focus { outline: none; border-color: var(--dx-accent); box-shadow: 0 0 0 3px var(--dx-accent-soft); }

/* 본문 행 */
.dxgrid-row { background: #fff; }
.dxgrid-row:nth-child(even) { background: var(--dx-row-alt); }
.dxgrid-row:hover { background: #f3f7ff; }
.dxgrid-row.selected { background: var(--dx-accent-soft); }
.dxgrid-row.selected:hover { background: #e2ebff; }
.dxgrid-row.editing { background: #fff8e6; }
.dxgrid-row.current { box-shadow: inset 3px 0 0 var(--dx-accent); }
.dxgrid-row.current td:first-child { position: relative; }
.dxgrid-cell-cmd { text-align: center; white-space: nowrap; }
.dxgrid-cell-cmd .dxbtn { margin: 0 1px; }

.align-left { text-align: left; }
.align-right { text-align: right; }
.align-center { text-align: center; }

.dxedit {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--dx-accent); border-radius: 5px; padding: 3px 6px; font-size: 12px;
}

/* 그룹 행 */
.dxgrid-grouprow td {
    background: #eef2f9;
    font-size: 12px;
    border-bottom: 1px solid var(--dx-border);
}
.dxgrid-caret {
    cursor: pointer; display: inline-block; width: 0; height: 0;
    border-style: solid; vertical-align: middle; margin-right: 8px;
}
.dxgrid-caret.is-collapsed {
    border-width: 5px 0 5px 7px;
    border-color: transparent transparent transparent var(--dx-accent);
}
.dxgrid-caret.is-expanded {
    border-width: 7px 5px 0 5px;
    border-color: var(--dx-accent) transparent transparent transparent;
}
.dxgrid-group-caption b { color: var(--dx-accent); }
.dxgrid-group-count { color: #7c8fac; margin-left: 6px; }
.dxgrid-group-sum {
    margin-left: 14px; color: #2a3547; font-weight: 600;
    background: #fff; border: 1px solid var(--dx-border); border-radius: 5px; padding: 0 6px;
}

/* 디테일 행 */
.dxgrid-detailrow td { background: #fbfcfe; padding: 0; }
.dxgrid-detail { padding: 12px 18px; border-left: 3px solid var(--dx-accent); }

/* 빈 데이터 */
.dxgrid-empty td { text-align: center; color: #7c8fac; padding: 28px; }

/* 푸터(요약) */
.dxgrid-footer td {
    position: sticky; bottom: 0; z-index: 3;
    background: linear-gradient(var(--dx-header-bg), var(--dx-header-bg2));
    font-weight: 700; color: var(--dx-accent);
    border-top: 2px solid var(--dx-border);
}

/* 페이저 */
.dxgrid-pager {
    display: flex; align-items: center; gap: 5px;
    padding: 8px 10px;
    background: #fff;
    border-top: 1px solid var(--dx-border);
    font-size: 12px; color: #5a6a85;
}
.dxpage {
    border: 1px solid var(--dx-border); background: #fff; border-radius: 6px;
    min-width: 28px; height: 26px; cursor: pointer; color: #5a6a85;
}
.dxpage:hover:not(:disabled) { border-color: var(--dx-accent); background: var(--dx-accent-soft); color: var(--dx-accent); }
.dxpage:disabled { opacity: .4; cursor: default; }
.dxgrid-pageinfo { margin: 0 8px; }
.dxgrid-pager-spacer { flex: 1; }
.dxgrid-pagesize { border: 1px solid var(--dx-border); border-radius: 6px; padding: 3px 6px; }

/* ───── 팝업 편집 폼 ───── */
@keyframes dxgrid-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dxgrid-modal-in {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dxgrid-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(17, 24, 39, .45);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: dxgrid-overlay-in .16s ease;
}
.dxgrid-modal {
    background: #fff; border-radius: 14px;
    width: 600px; max-width: 100%; max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(17,24,39,.32), 0 4px 12px rgba(17,24,39,.14);
    user-select: text; overflow: hidden;
    animation: dxgrid-modal-in .22s cubic-bezier(.2,.8,.25,1);
}
.dxgrid-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; color: #fff;
    background: linear-gradient(135deg, #5d87ff 0%, #4570ea 60%, #7c4dff 100%);
}
.dxgrid-modal-titlewrap { display: flex; align-items: center; gap: 14px; }
.dxgrid-modal-icon {
    flex: none; width: 40px; height: 40px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
    background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.dxgrid-modal-title { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.dxgrid-modal-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.dxgrid-modal-close {
    border: none; background: rgba(255,255,255,.16); color: #fff;
    width: 30px; height: 30px; border-radius: 8px;
    font-size: 15px; cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.dxgrid-modal-close:hover { background: rgba(255,255,255,.32); }
.dxgrid-modal-body {
    padding: 22px; overflow: auto; background: #f8fafc;
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}
.dxgrid-formrow { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dxgrid-formlabel {
    font-size: 12px; color: #64748b; font-weight: 600;
    letter-spacing: .2px; text-transform: none;
}
.dxgrid-formfield { display: flex; align-items: center; min-width: 0; }
.dxgrid-formfield .dxedit { width: 100%; }
.dxgrid-modal .dxedit {
    border: 1px solid #d6dde6; border-radius: 9px;
    padding: 9px 12px; font-size: 13px; background: #fff;
    color: #1f2937; transition: border-color .12s, box-shadow .12s;
}
.dxgrid-modal .dxedit:hover { border-color: #b6c2d0; }
.dxgrid-modal .dxedit:focus {
    outline: none; border-color: var(--dx-accent);
    box-shadow: 0 0 0 3px rgba(93,135,255,.18);
}
.dxgrid-formreadonly {
    width: 100%; color: #475569; font-size: 13px;
    background: #eef2f7; border: 1px dashed #d6dde6; border-radius: 9px;
    padding: 9px 12px; min-height: 38px; display: flex; align-items: center;
}
.dxgrid-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 0; }
.dxgrid-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.dxgrid-switch-track {
    position: relative; width: 42px; height: 23px; border-radius: 999px;
    background: #cbd5e1; transition: background .18s;
}
.dxgrid-switch-track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 19px; height: 19px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
}
.dxgrid-switch input:checked + .dxgrid-switch-track { background: var(--dx-accent); }
.dxgrid-switch input:checked + .dxgrid-switch-track::after { transform: translateX(19px); }
.dxgrid-switch-text { font-size: 12.5px; color: #475569; font-weight: 600; }
.dxgrid-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 22px; border-top: 1px solid #e7ecf2; background: #fff;
}
.dxgrid-modal-footer .dxbtn {
    padding: 9px 20px; font-size: 13px; border-radius: 9px; font-weight: 600;
}
.dxgrid-modal-footer .dxbtn-primary { box-shadow: 0 4px 12px rgba(93,135,255,.32); }
.dxgrid-modal-footer .dxbtn-primary:hover { box-shadow: 0 6px 16px rgba(93,135,255,.4); }
@media (max-width: 560px) {
    .dxgrid-modal-body { grid-template-columns: 1fr; }
}

/* ───── 삭제 확인 메시지 박스 ───── */
.dxgrid-confirm { width: 420px; }
.dxgrid-confirm-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #b91c1c 100%);
}
.dxgrid-confirm-body {
    padding: 22px; background: #fff;
    display: flex; flex-direction: column; gap: 10px;
}
.dxgrid-confirm-msg { font-size: 14px; color: #1f2937; font-weight: 600; }
.dxgrid-confirm-detail {
    font-size: 12.5px; color: #475569;
    background: #f8fafc; border: 1px solid #e7ecf2; border-radius: 9px;
    padding: 10px 12px; line-height: 1.5;
}
