/* ===== RadioPanel base styles ===== */

* { scrollbar-width: thin; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* ===== DataTables ===== */
table.dataTable { width: 100% !important; border-collapse: separate; }
.select-checkbox { width: 40px !important; text-align: center !important; }
.row-checkbox,
.js-select-all {
    height: 1rem;
    width: 1rem;
    accent-color: #4f46e5;
    cursor: pointer;
    border-radius: 0.25rem;
    border: 1px solid #cbd5e1;
}
.dark .row-checkbox,
.dark .js-select-all { border-color: #475569; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.375rem 0.625rem;
    background: #fff;
    color: #1e293b;
    outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.dataTables_wrapper .dataTables_filter { text-align: right; }
.dark table.dataTable { color: #e2e8f0; }
.dark .dataTables_wrapper .dataTables_filter input,
.dark .dataTables_wrapper .dataTables_length select {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.dark table.dataTable thead th { color: #cbd5e1; }
.dark table.dataTable td { border-bottom-color: #334155 !important; }
.dark table.dataTable.row-border tbody th,
.dark table.dataTable.row-border tbody td { border-top-color: #334155 !important; }
.dark .dataTables_wrapper .dataTables_info,
.dark .dataTables_wrapper .dataTables_paginate .paginate_button { color: #94a3b8 !important; }
.dark .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
}
.dataTables_wrapper .dt-buttons .dt-button {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background: #fff;
    color: #475569;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}
.dark .dataTables_wrapper .dt-buttons .dt-button {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.dataTables_wrapper .dt-buttons .dt-button:hover {
    background: #eef2ff;
    color: #4338ca;
}
.dark .dataTables_wrapper .dt-buttons .dt-button:hover {
    background: #312e81;
    color: #e0e7ff;
}

/* ===== TomSelect ===== */
.ts-wrapper { width: 100%; }
.ts-wrapper .ts-control {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-height: 2.6rem;
    color: #1e293b !important;
    box-shadow: none !important;
    width: 100% !important;
}
.ts-wrapper .ts-control .item,
.ts-wrapper .ts-control .dropdown-menu .dropdown-item {
    color: #1e293b !important;
}
.ts-wrapper.focus .ts-control { border-color: #6366f1 !important; box-shadow: 0 0 0 2px rgba(99,102,241,.25) !important; }
.ts-wrapper .ts-dropdown,
body > .ts-dropdown {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 0.5rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, .12) !important;
}
.ts-wrapper .ts-dropdown .option,
body > .ts-dropdown .option {
    background: transparent !important;
    color: #1e293b !important;
}
.ts-wrapper .ts-dropdown .active,
body > .ts-dropdown .active {
    background: #eef2ff !important;
    color: #3730a3 !important;
}
.ts-wrapper .ts-dropdown .optgroup-header,
body > .ts-dropdown .optgroup-header { color: #64748b !important; }
.ts-wrapper .ts-control .item {
    background: #eef2ff !important;
    color: #3730a3 !important;
    border-radius: 0.375rem;
}
.ts-wrapper .ts-control .remove { color: #3730a3 !important; }

.dark .ts-wrapper .ts-control {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
.dark .ts-wrapper .ts-control .item { color: #e2e8f0 !important; }
.dark .ts-wrapper .ts-dropdown,
.dark body > .ts-dropdown { background: #1e293b !important; border-color: #475569 !important; }
.dark .ts-wrapper .ts-dropdown .option,
.dark body > .ts-dropdown .option { color: #e2e8f0 !important; }
.dark .ts-wrapper .ts-dropdown .active,
.dark body > .ts-dropdown .active { background: #312e81 !important; color: #e0e7ff !important; }
.dark .ts-wrapper .ts-dropdown .optgroup-header,
.dark body > .ts-dropdown .optgroup-header { color: #94a3b8 !important; }
.dark .ts-wrapper .ts-control .item {
    background: #312e81 !important;
    color: #e0e7ff !important;
}
.dark .ts-wrapper .ts-control .remove { color: #e0e7ff !important; }

/* ===== SweetAlert2 dark overrides ===== */
.dark .swal2-popup { background: #1e293b; }
.dark .swal2-title, .dark .swal2-html-container { color: #e2e8f0; }
.dark .swal2-toast { background: #1e293b; }
.dark .swal2-toast .swal2-title { color: #e2e8f0; }

/* ===== Sidebar collapsed on desktop ===== */
body.sidebar-collapsed #sidebar { transform: -translate-x-full; }
body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
body.sidebar-collapsed #main-content { margin-left: 0; }

@media (min-width: 1024px) {
    #main-content { margin-left: 16rem; }
    #sidebar { transform: translateX(0); }
    body.sidebar-collapsed #main-content { margin-left: 0; }
    body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
}

/* form field base (CSS plano: el CDN de Tailwind no procesa @apply) */
.rp-field {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: #fff;
    color: #1e293b;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.rp-field::placeholder { color: #94a3b8; }
.rp-field:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.dark .rp-field {
    background-color: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.dark .rp-field::placeholder { color: #64748b; }
.dark .rp-field:focus { border-color: #6366f1; }
