/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2026 D-TEG Co.Ltd AppTeam Taiminko
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
.dtgrid {
    display: block; /* reuses index.html's <table id="jqLive"> as the container — cancels the table layout */
    position: relative;
    border: 1px solid #ddd;
    background: #fff; /* opaque so UI behind it (e.g. divDailyTbl's gray background) does not show through */
    font-size: 13px;
    overflow: hidden;
}

.dtgrid-header {
    overflow: hidden;
    background: #eee;
    border-bottom: 1px solid #ccc;
}

.dtgrid-htrow {
    display: flex;
    height: 20px;
}

.dtgrid-th {
    box-sizing: border-box;
    position: relative;
    padding: 0 2px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    font-weight: normal;
    border-right: 1px solid #ccc;
    flex-shrink: 0;
}

.dtgrid-th-label {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
    padding-right: 6px;
}

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

.dtgrid-resizer:hover {
    background: #99c;
    opacity: 0.5;
}

.dtgrid-body {
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
}

.dtgrid-spacer {
    position: relative;
}

.dtgrid-rows {
    position: relative;
}

.dtgrid-row {
    position: absolute;
    left: 0;
    display: flex;
    height: 23px;
    width: 100%;
}

.dtgrid-row.dtgrid-selected {
    /* selected row colors — same values as jquery-ui.theme.css .ui-state-highlight */
    background: #d2c5b3;
    color: #880051;
}

/* findRow mark — a frame laid over the cells; an inset shadow would sit under cell backgrounds. Taiminko 20261105 */
.dtgrid-row.dtgrid-found::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid #e07b00;
    pointer-events: none;
}

.dtgrid-cell {
    box-sizing: border-box;
    padding: 0 2px;
    height: 23px;
    line-height: 23px;
    overflow: hidden;
    white-space: pre;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
}

.dtgrid-cell[data-col="Icon"] {
    display: flex;
    align-items: center; /* rows (23px) are taller than icons (16px) — center vertically */
    justify-content: center;
}

.dtgrid-cell.dtgrid-rownum {
    text-align: center;
    color: #555;
    font-size: 13px; /* same as the body — rownumWidth 30px (dtMain.js) leaves room */
}

.dtgrid-th.dtgrid-rownum-th {
    text-align: center;
}

/* ---- grouping / inline edit (opt-in, for UTILWEB PARSER dtIni) ---- */
.dtgrid-group-row {
    position: absolute;
    left: 0;
    width: 100%;
    height: 23px;
    line-height: 23px;
    box-sizing: border-box;
    padding: 0 6px;
    background: #eef2f6;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.dtgrid-group-toggle {
    display: inline-block;
    width: 12px;
    font-weight: normal;
}

.dtgrid-edit-input {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 0 2px;
    border: 1px solid #99c;
    font-size: 13px;
    font-family: inherit;
}

/* ---- multiselect checkbox column ---- */
.dtgrid-cell.dtgrid-multisel,
.dtgrid-th.dtgrid-multisel-th {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dtgrid-multisel input,
.dtgrid-multisel-all {
    width: 13px;
    height: 13px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent, #3860e0);
}

/* sorted column mark (▲/▼) */
.dtgrid-sort-ico { font-size: 9px; opacity: .7; }

/* ---- dark colors: add class="dtgrid-dark" to an ancestor (e.g. <body>).
   Colors use the :root tokens (--surface etc.) with fallbacks for pages without them. ---- */
.dtgrid-dark .dtgrid {
    box-sizing: border-box;
    border: 1px solid var(--border, #2a2e3a);
    border-radius: 8px;
    background: var(--surface, #1a1d26);
    color: var(--ink, #e8e8ee);
    font-size: 12px;
}

.dtgrid-dark .dtgrid-header {
    background: var(--surface2, #232733);
    border-bottom: 1px solid var(--border2, #3a3f4e);
}

.dtgrid-dark .dtgrid-th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-muted, #9aa3b8);
    border-right: 1px solid var(--border, #2a2e3a);
}

.dtgrid-dark .dtgrid-th-label:hover { color: var(--accent-ink, #8fb3ff); }

.dtgrid-dark .dtgrid-resizer:hover {
    background: var(--accent, #3860e0);
    opacity: .6;
}

.dtgrid-dark .dtgrid-row:hover { background: var(--surface2, #232733); }

.dtgrid-dark .dtgrid-row.dtgrid-selected {
    background: var(--accent-seq-1, #1c2740);
    color: var(--accent-ink, #8fb3ff);
    box-shadow: inset 2px 0 0 var(--accent, #3860e0);
}

.dtgrid-dark .dtgrid-cell {
    border-bottom: 1px solid var(--border, #2a2e3a);
    border-right: 1px solid var(--border, #2a2e3a);
}

.dtgrid-dark .dtgrid-cell.dtgrid-rownum {
    color: var(--ink-muted, #9aa3b8);
    background: var(--surface2, #232733);
    font-size: inherit;
}

.dtgrid-dark .dtgrid-group-row {
    background: var(--surface2, #232733);
    color: var(--accent-ink, #8fb3ff);
    border-bottom: 1px solid var(--border, #2a2e3a);
}

.dtgrid-dark .dtgrid-edit-input {
    border: 1px solid var(--accent, #3860e0);
    border-radius: 3px;
    background: var(--bg, #12141a);
    color: var(--ink, #e8e8ee);
    font-size: 12px;
    outline: none;
}

/* keep the light default scrollbar from standing out on dark backgrounds */
.dtgrid-dark .dtgrid-body::-webkit-scrollbar { width: 10px; height: 10px; }
.dtgrid-dark .dtgrid-body::-webkit-scrollbar-track { background: var(--surface, #1a1d26); }
.dtgrid-dark .dtgrid-body::-webkit-scrollbar-thumb {
    background: var(--border2, #3a3f4e);
    border-radius: 5px;
    border: 2px solid var(--surface, #1a1d26);
}
.dtgrid-dark .dtgrid-body::-webkit-scrollbar-thumb:hover { background: var(--ink-muted, #9aa3b8); }

/* multiselect drag: no text selection while rows are being checked */
.dtgrid-dragging .dtgrid-body {
    user-select: none;
}
