/* ========================================================================
   DR Inventory - Component Customizations (Vircle-inspired)
   DataTables, SweetAlert2, Select2, Flatpickr
   ======================================================================== */

/* ========================================================================
   DATATABLES
   ======================================================================== */

/* Toolbar layout (search + length) */
.dt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
    border-bottom: 1px solid var(--color-border-light);
}

/* Footer layout (info + pagination) */
.dt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
}

/* Length menu */
.dataTables_length {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0;
}

.dataTables_length select {
    padding: 4px 6px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    cursor: pointer;
    min-width: 50px;
    height: 28px;
}

.dataTables_length select:focus {
    border-color: var(--color-primary);
}

/* Search/Filter */
.dataTables_filter {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0;
}

.dataTables_filter input[type="search"] {
    padding: 4px 10px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    width: 180px;
    height: 28px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dataTables_filter input[type="search"]:focus {
    border-color: var(--color-primary);
}

.dataTables_filter input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23adb5bd'%3E%3Cpath d='M18.3 5.71a1 1 0 00-1.42 0L12 10.59 7.12 5.71a1 1 0 00-1.42 1.42L10.59 12l-4.88 4.88a1 1 0 101.42 1.42L12 13.41l4.88 4.88a1 1 0 001.42-1.42L13.41 12l4.88-4.88a1 1 0 000-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Info text */
.dataTables_info {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

/* Pagination */
.dataTables_paginate {
    display: flex;
    align-items: center;
    gap: 2px;
}

.dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.dataTables_paginate .paginate_button:hover {
    background-color: var(--color-gray-200);
    color: var(--color-text);
}

.dataTables_paginate .paginate_button.current {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-white);
    font-weight: 600;
}

.dataTables_paginate .paginate_button.current:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--color-text-white);
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Processing overlay */
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 12px;
    background-color: rgba(255,255,255,0.9);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

/* Empty table */
.dataTables_empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 16px 0;
    font-size: var(--font-size-sm);
}

/* DataTables wrapper inside card */
.card-body-table .dataTables_wrapper {
    width: 100%;
}

/* Override DataTables default table style - ezadmin bordered */
table.dataTable {
    border-collapse: collapse;
    width: 100% !important;
    margin: 0;
}

table.dataTable thead th {
    padding: 6px 8px;
    background-color: var(--color-gray-100);
    border: 1px solid var(--color-border);
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    text-align: center;
}

table.dataTable tbody td {
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}

table.dataTable tbody tr {
    height: 32px;
}

table.dataTable tbody tr:hover {
    background-color: var(--color-primary-light) !important;
}

table.dataTable tbody tr.selected {
    background-color: #d4e9f7 !important;
}

/* Sorting arrows */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 18px;
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 9px;
    color: var(--color-text-muted);
}

table.dataTable thead .sorting::after {
    content: '\f0dc';
}

table.dataTable thead .sorting_asc::after {
    content: '\f0de';
    color: var(--color-primary);
}

table.dataTable thead .sorting_desc::after {
    content: '\f0dd';
    color: var(--color-primary);
}

/* Remove default DataTables bottom border */
table.dataTable.no-footer {
    border-bottom: none;
}

/* Checkbox column */
table.dataTable thead th.dt-checkbox,
table.dataTable tbody td.dt-checkbox {
    text-align: center;
    width: 30px;
    padding: 4px;
}

table.dataTable thead th.dt-checkbox input[type="checkbox"],
table.dataTable tbody td.dt-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* DataTables Fixed Header - Scroll Container Mode */
.dataTables_wrapper.dt-scroll-enabled {
    overflow-y: auto;
    overflow-x: auto;
}

.dataTables_wrapper.dt-scroll-enabled .dt-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    background-color: #fff;
}

.dataTables_wrapper.dt-scroll-enabled table.dataTable.dt-fixed-header thead th {
    position: sticky;
    top: var(--dt-toolbar-h, 0px);
    z-index: 3;
    background-color: var(--color-gray-100);
}

/* 헤더 위 툴바 밴드 가림막(cap)
   - 툴바(.dt-toolbar)는 스크롤 컨테이너의 client 폭만 차지하므로,
     테이블이 가로로 오버플로된 영역(또는 가로 스크롤 시)에는 툴바가 없어
     세로 스크롤된 행이 고정 헤더 위로 삐져나와 보인다.
   - 각 th에 툴바 높이만큼의 ::before 캡을 붙여 테이블 전체 폭에 걸쳐
     헤더 위 밴드를 불투명하게 덮는다. (정렬 아이콘은 ::after 사용 → 충돌 없음)
   - left/right -1px: border-collapse 경계 1px 틈새 가림 */
.dataTables_wrapper.dt-scroll-enabled table.dataTable.dt-fixed-header thead th::before {
    content: '';
    position: absolute;
    left: -1px;
    right: -1px;
    top: calc(-1 * var(--dt-toolbar-h, 0px));
    height: var(--dt-toolbar-h, 0px);
    background-color: #fff;
}

.dataTables_wrapper.dt-scroll-enabled .dt-footer {
    position: sticky;
    bottom: 0;
    z-index: 4;
    background-color: #fff;
    border-top: 1px solid var(--color-border);
}

/* Fixed Header Toggle */
.dt-toolbar-toggles {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dt-fixed-header-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.dt-fixed-header-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.dt-fixed-header-toggle:has(input:checked) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.dt-fixed-header-toggle input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.dt-fixed-header-toggle i {
    font-size: 10px;
}

.dt-fixed-header-toggle span {
    font-size: var(--font-size-xs);
    line-height: 1;
}

/* Responsive DataTables */
@media (max-width: 767px) {
    .dt-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 6px 8px;
    }

    .dataTables_length,
    .dataTables_filter,
    .dataTables_length label,
    .dataTables_filter label {
        width: 100%;
    }

    .dataTables_length label,
    .dataTables_filter label {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 8px;
    }

    .dataTables_length label {
        justify-content: start;
    }

    .dataTables_filter {
        min-width: 0;
    }

    .dataTables_filter input[type="search"] {
        width: 100%;
        height: 32px;
    }

    .dataTables_length select {
        min-width: 84px;
        height: 32px;
    }

    .dt-fixed-header-toggle {
        width: 100%;
        justify-content: center;
    }

    .dt-footer {
        flex-direction: column;
        gap: 4px;
        text-align: center;
        padding: 6px 8px;
    }

    .dataTables_paginate {
        justify-content: center;
        flex-wrap: wrap;
    }
}


/* ========================================================================
   SWEETALERT2
   ======================================================================== */
.swal2-container {
    z-index: 10060 !important;
}

.swal2-popup {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    border-radius: var(--radius-lg);
}

.swal2-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
}

.swal2-html-container {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.swal2-confirm.swal2-styled {
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: 4px 16px;
    border-radius: var(--radius-sm);
    min-height: 28px;
}

.swal2-cancel.swal2-styled {
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: 4px 16px;
    border-radius: var(--radius-sm);
    min-height: 28px;
}

.swal2-toast {
    font-size: var(--font-size-sm);
}

.swal2-toast .swal2-title {
    font-size: var(--font-size-sm);
    font-weight: 500;
}


/* ========================================================================
   SELECT2
   ======================================================================== */
.select2-container--default .select2-selection--single {
    height: 34px;
    min-height: 34px;
    padding: 0 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-card);
    outline: none;
    transition: border-color var(--transition-fast);
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--color-primary);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--color-text);
    font-size: var(--font-size-sm);
    line-height: 32px;
    padding: 0 4px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--color-text-muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px;
    right: 6px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--color-gray-400) transparent transparent transparent;
}

/* Multiple */
.select2-container--default .select2-selection--multiple {
    min-height: 34px;
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-card);
}

.select2-container--default .select2-selection--multiple:focus,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--color-primary);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--color-primary-light);
    border: 1px solid rgba(19,76,255,0.15);
    border-radius: var(--radius-md);
    padding: 1px 6px;
    font-size: var(--font-size-xs);
    color: var(--color-primary);
    line-height: 1.6;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--color-primary);
    margin-right: 2px;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 2100;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    padding: 6px 10px;
    font-size: var(--font-size-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    height: 30px;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--color-primary);
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.select2-container--default .select2-results__message {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    padding: 6px;
}


/* ========================================================================
   FLATPICKR
   ======================================================================== */
.flatpickr-calendar {
    font-family: var(--font-family);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    width: 324px !important;
    z-index: 12000 !important;
}

.flatpickr-months {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.flatpickr-months .flatpickr-month {
    height: 30px;
}

.flatpickr-current-month {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.flatpickr-rContainer,
.flatpickr-weekdays,
.flatpickr-days,
.dayContainer {
    width: 308px !important;
    min-width: 308px !important;
    max-width: 308px !important;
}

.flatpickr-day {
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
    height: 34px;
    line-height: 34px;
    margin: 0;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.flatpickr-day.inRange {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary-light);
    box-shadow: -5px 0 0 var(--color-primary-light), 5px 0 0 var(--color-primary-light);
}

.flatpickr-day:hover {
    background-color: var(--color-gray-100);
    border-color: var(--color-gray-100);
}

.flatpickr-day.today {
    border-color: var(--color-primary);
}

.flatpickr-day.today:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
}

span.flatpickr-weekday {
    flex: 0 0 44px !important;
    width: 44px !important;
    max-width: 44px !important;
    height: 28px;
    line-height: 28px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-gray-600);
}

.flatpickr-input {
    cursor: pointer;
}

/* Flatpickr in form */
.flatpickr-input.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512' fill='%23adb5bd'%3E%3Cpath d='M152 24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H64C28.7 64 0 92.7 0 128v16 48V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V192 144 128c0-35.3-28.7-64-64-64H344V24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H152V24zM48 192H400V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px;
    padding-right: 22px;
}


/* ========================================================================
   SESSION LOGIN MODAL (Session Expired Overlay)
   ======================================================================== */

.session-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-login-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 380px;
    max-width: 90vw;
    padding: 32px;
    animation: sessionModalSlideIn 0.25s ease-out;
}

@keyframes sessionModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.session-login-header {
    text-align: center;
    margin-bottom: 24px;
}

.session-login-header i {
    font-size: 36px;
    color: #dc3545;
    margin-bottom: 12px;
    display: block;
}

.session-login-header h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.session-login-header p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
}

.session-login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.session-login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.session-login-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.session-login-field input:focus {
    outline: none;
    border-color: #3b7ddd;
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.1);
}

.session-login-error {
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #dc3545;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.session-login-btn {
    width: 100%;
    padding: 11px;
    background: #3b7ddd;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

.session-login-btn:hover {
    background: #326abc;
}

.session-login-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* Server-backed autocomplete */
.dr-autocomplete-dropdown {
    position: fixed;
    z-index: 12000;
    max-height: min(320px, 48vh);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.dr-autocomplete-dropdown[hidden] {
    display: none;
}

.dr-autocomplete-item {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #1f2937;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.dr-autocomplete-item:hover,
.dr-autocomplete-item.is-active {
    background: #eef2ff;
}

.dr-autocomplete-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.dr-autocomplete-label {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-autocomplete-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.3;
}

.dr-autocomplete-desc {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-autocomplete-dropdown mark {
    padding: 0 1px;
    border-radius: 2px;
    background: #fde68a;
    color: inherit;
    font-weight: 800;
}

html.dark .dr-autocomplete-dropdown {
    border-color: #475569;
    background: #111827;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.38);
}

html.dark .dr-autocomplete-item {
    color: #e5e7eb;
}

html.dark .dr-autocomplete-item:hover,
html.dark .dr-autocomplete-item.is-active {
    background: #1f2937;
}

html.dark .dr-autocomplete-badge {
    background: #334155;
    color: #cbd5e1;
}

html.dark .dr-autocomplete-desc {
    color: #94a3b8;
}

html.dark .dr-autocomplete-dropdown mark {
    background: #854d0e;
    color: #fef3c7;
}

/* Common Excel preview + field mapping */
.dr-excel-preview-host {
    margin-top: 12px;
}

.dr-excel-preview {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-card);
}

.dr-excel-preview-empty,
.dr-excel-preview-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 84px;
    padding: 16px;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-align: center;
}

.dr-excel-preview-status-loading i {
    color: var(--color-primary);
}

.dr-excel-preview-status-error {
    color: var(--color-danger);
    background: var(--color-danger-light);
}

.dr-excel-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.dr-excel-preview-head strong {
    display: block;
    overflow: hidden;
    max-width: 520px;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-excel-preview-head strong + span {
    display: block;
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

.dr-excel-sheet-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.dr-excel-sheet-select select,
.dr-excel-mapping-grid select {
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.dr-excel-sheet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-gray-50);
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
}

.dr-excel-sheet-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.dr-excel-mapping {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.dr-excel-mapping-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.dr-excel-mapping-head strong {
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.dr-excel-mapping-warning {
    margin-bottom: 8px;
    padding: 7px 9px;
    border: 1px solid rgba(220, 53, 69, 0.22);
    border-radius: var(--radius-md);
    background: var(--color-danger-light);
    color: var(--color-danger);
    font-size: var(--font-size-xs);
}

.dr-excel-mapping-grid {
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.dr-excel-mapping-grid table {
    width: 100%;
    border-collapse: collapse;
}

.dr-excel-mapping-grid th,
.dr-excel-mapping-grid td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
}

.dr-excel-mapping-grid th {
    width: 220px;
    background: var(--color-gray-50);
    color: var(--color-text);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.dr-excel-mapping-grid td select {
    width: 100%;
}

.dr-excel-mapping-grid tr:last-child th,
.dr-excel-mapping-grid tr:last-child td {
    border-bottom: 0;
}

.dr-excel-mapping .required {
    color: var(--color-danger);
}

.dr-excel-table-wrap {
    overflow-x: auto;
}

.dr-excel-preview-table {
    min-width: 900px;
}

.dr-excel-preview-table td {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-excel-preview .dataTables_wrapper {
    min-width: 100%;
}

html.dark .dr-excel-preview {
    border-color: #334155;
    background: #111827;
}

html.dark .dr-excel-sheet-meta,
html.dark .dr-excel-mapping-grid th {
    background: #1f2937;
}

html.dark .dr-excel-mapping-grid {
    border-color: #334155;
}

@media (max-width: 767px) {
    .dr-excel-preview-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dr-excel-preview-head strong {
        max-width: 100%;
    }

    .dr-excel-sheet-select {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .dr-excel-mapping-grid th,
    .dr-excel-mapping-grid td {
        display: block;
        width: 100%;
    }

    .dr-excel-mapping-grid th {
        border-bottom: 0;
        white-space: normal;
    }
}
