:root {
    color-scheme: dark;
    --shell: #201d1e;
    --sidebar: transparent;
    --panel: #121011;
    --panel-soft: #242122;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-strong: rgba(255, 255, 255, 0.1);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --stroke: #3a3638;
    --stroke-soft: rgba(255, 255, 255, 0.08);
    --stroke-faint: rgba(255, 255, 255, 0.045);
    --text-main: #f5f1ee;
    --text-strong: #f3eeea;
    --text-muted: #d3cbc5;
    --text-dim: #a49a94;
    --chip: #3f474f;
    --chip-text: #eef4f7;
    --active-bg: rgba(144, 226, 2, 0.15);
    --active-text: #90E202;
    --table-head: #242122;
    --table-body: #1c191a;
    --icon-button: rgba(255, 255, 255, 0.1);
    --scroll-thumb: #bdb7b2;
    --hero-title: #f3eeea;
    --primary-btn-bg: #90E202;
    --primary-btn-text: #1a1a1a;
    --nav-active-bg: rgba(144, 226, 2, 0.2);
    --nav-active-text: #90E202;
    --accent: #90E202;
    --accent-dim: rgba(144, 226, 2, 0.5);
    --accent-soft: rgba(144, 226, 2, 0.1);
}

html[data-theme="light"] {
    color-scheme: light;
    --shell: #f0ece9;
    --sidebar: rgba(255, 255, 255, 0.2);
    --panel: #f7f3f2;
    --panel-soft: #ece7e3;
    --surface: rgba(42, 34, 28, 0.04);
    --surface-strong: rgba(42, 34, 28, 0.08);
    --surface-hover: rgba(42, 34, 28, 0.05);
    --stroke: #cfc7c2;
    --stroke-soft: rgba(42, 34, 28, 0.14);
    --stroke-faint: rgba(42, 34, 28, 0.07);
    --text-main: #171417;
    --text-strong: #171417;
    --text-muted: #5d5550;
    --text-dim: #706863;
    --chip: #e0e0de;
    --chip-text: #2d2a29;
    --active-bg: rgba(144, 226, 2, 0.15);
    --active-text: #5a8c00;
    --table-head: #e8e3df;
    --table-body: #f6f2f0;
    --icon-button: rgba(42, 34, 28, 0.07);
    --scroll-thumb: #6f7176;
    --hero-title: #171417;
    --primary-btn-bg: #5a8c00;
    --primary-btn-text: #ffffff;
    --nav-active-bg: rgba(144, 226, 2, 0.2);
    --nav-active-text: #3d6000;
    --accent: #5a8c00;
    --accent-dim: rgba(90, 140, 0, 0.5);
    --accent-soft: rgba(144, 226, 2, 0.1);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 999px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

body {
    background: var(--shell);
    color: var(--text-main);
    transition: background-color 0.25s ease, color 0.25s ease;
}

i {
    line-height: 0 !important;
}

.fluent-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.icon-center {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.theme-shell {
    background: var(--shell);
}

.theme-panel {
    background: var(--panel);
}

.theme-panel-soft {
    background: var(--panel-soft);
}

.theme-surface {
    background: var(--surface);
}

.theme-surface-strong {
    background: var(--surface-strong);
}

.theme-surface-hover:hover {
    background: var(--surface-hover);
}

.theme-stroke {
    border-color: var(--stroke);
}

.theme-stroke-soft {
    border-color: var(--stroke-soft);
}

.theme-text {
    color: var(--text-main);
}

.theme-text-strong {
    color: var(--text-strong);
}

.theme-text-muted {
    color: var(--text-muted);
}

.theme-text-dim {
    color: var(--text-dim);
}

.theme-chip {
    background: var(--chip);
    color: var(--chip-text);
}

.theme-active {
    background: var(--active-bg);
    color: var(--active-text);
}

.theme-table-head {
    background: var(--table-head);
}

.theme-table-body {
    background: var(--table-body);
}

.theme-icon-button:hover,
.theme-nav-link:hover {
    background: var(--surface-hover);
}

.theme-sidebar {
    background: var(--sidebar);
}

.hero-title {
    color: var(--hero-title);
}

.theme-primary-btn {
    background: var(--primary-btn-bg);
    color: var(--primary-btn-text);
}

.theme-primary-btn:hover {
    filter: brightness(1.04);
}

.theme-dropdown {
    background: var(--panel);
    border: 1px solid var(--stroke-soft);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14);
    max-height: min(28.6rem, calc(100vh - 7rem));
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.theme-dropdown.is-scrollable {
    overflow-y: auto;
    scrollbar-width: thin;
    -ms-overflow-style: auto;
}

.theme-dropdown::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.theme-dropdown.is-scrollable::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    display: block;
}

.theme-dropdown.is-scrollable::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 999px;
}

.theme-dropdown.is-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.theme-dropdown-row {
    border-color: var(--stroke-soft);
}

.theme-dropdown-row:hover {
    background: var(--surface-hover);
}

.theme-switch {
    background: var(--surface-strong);
}

.theme-switch-knob {
    background: var(--text-strong);
}

.theme-dropdown.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.layout-row {
    transition: gap 0.28s ease;
}

.layout-sidebar {
    width: 280px;
    min-width: 280px;
    opacity: 1;
    overflow: hidden;
    transform: translateX(0);
    transition:
        width 0.28s ease,
        min-width 0.28s ease,
        opacity 0.22s ease,
        transform 0.28s ease,
        margin 0.28s ease;
}

.sidebar-hidden .layout-row {
    gap: 0;
}

.sidebar-hidden .layout-sidebar {
    width: 0;
    min-width: 0;
    opacity: 0;
    margin-right: 0;
    transform: translateX(-16px);
    pointer-events: none;
}

.theme-modal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.theme-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.theme-modal-backdrop {
    background: rgba(12, 10, 10, 0.42);
    backdrop-filter: blur(4px);
}

html[data-theme="light"] .theme-modal-backdrop {
    background: rgba(28, 22, 18, 0.22);
}

.theme-modal-panel {
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
    transform: scale(0.97) translateY(10px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-modal.is-open .theme-modal-panel {
    transform: scale(1) translateY(0);
}

.modal-sm {
    max-width: 32rem;
}

.modal-lg {
    max-width: 64rem;
}

.modal-xl {
    max-width: 76rem;
}

.modal-fullscreem {
    width: calc(100vw - 2rem);
    max-width: none;
    height: calc(100vh - 2rem);
    max-height: none;
    border-radius: 1.5rem;
}


.theme-modal-body {
    background: color-mix(in srgb, var(--panel) 100%, transparent);
}

.theme-button-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 2.9rem;
    border-radius: 999px;
    padding: 0 1.15rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        opacity 0.18s ease,
        transform 0.14s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
    line-height: 1;
    cursor: pointer;
}

.theme-button-base:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.theme-button-base:active {
    opacity: 1;
    transform: translateY(0) scale(0.97);
    box-shadow: none;
}

.theme-button-base i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.theme-button-base span {
    line-height: 1;
}

.theme-button-soft {
    background: var(--surface);
    border: 1px solid var(--stroke-soft);
    color: var(--text-main);
}

.theme-button-soft:hover {
    background: var(--surface-strong);
    border-color: var(--stroke);
}

.theme-button-outlined {
    background: transparent;
    border: 1px solid var(--stroke);
    color: var(--text-main);
}

.theme-button-outlined:hover {
    background: var(--surface);
    border-color: var(--text-muted);
}

.theme-button-solid {
    background: var(--text-main);
    border: 1px solid transparent;
    color: var(--panel);
}

.theme-button-solid:hover {
    filter: brightness(0.94);
}

.theme-button-accent {
    background: var(--primary-btn-bg);
    border: 1px solid transparent;
    color: var(--primary-btn-text);
}

.theme-button-accent:hover {
    filter: brightness(1.07);
    box-shadow: 0 4px 18px rgba(144, 226, 2, 0.28);
}

.theme-button-accent:active {
    filter: brightness(0.96);
}

html[data-theme="light"] .theme-button-accent:hover {
    box-shadow: 0 4px 18px rgba(90, 140, 0, 0.22);
}

.theme-button-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.theme-button-danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.38);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.14);
}

html[data-theme="light"] .theme-button-danger {
    background: rgba(220, 38, 38, 0.07);
    border-color: rgba(220, 38, 38, 0.18);
    color: #dc2626;
}

html[data-theme="light"] .theme-button-danger:hover {
    background: rgba(220, 38, 38, 0.14);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.1);
}

.theme-button-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
}

.theme-button-ghost:hover {
    background: var(--surface);
    color: var(--text-main);
    box-shadow: none;
}

.theme-button-sm {
    min-height: 2.2rem;
    padding: 0 0.85rem;
    font-size: 0.875rem;
    gap: 0.4rem;
}

.theme-button-lg {
    min-height: 3.35rem;
    padding: 0 1.6rem;
    font-size: 1rem;
    gap: 0.65rem;
}

.theme-button-icon-only {
    padding: 0;
    min-height: 2.9rem;
    width: 2.9rem;
}

.theme-button-icon-only.theme-button-sm {
    min-height: 2.2rem;
    width: 2.2rem;
}

.tooltip-group {
    position: relative;
}

.theme-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.6rem);
    transform: translateX(-50%) translateY(4px);
    background: var(--panel);
    color: var(--text-main);
    border: 1px solid var(--stroke-soft);
    border-radius: 999px;
    padding: 0.38rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.tooltip-group:hover .theme-tooltip,
.tooltip-group:focus-within .theme-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Status Badges ─────────────────────────────────────────── */

.theme-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.theme-badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.theme-badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.theme-badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.theme-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.theme-badge-neutral {
    background: var(--surface-strong);
    color: var(--text-muted);
}

.theme-badge-accent {
    background: var(--accent-soft);
    color: var(--accent);
}

html[data-theme="light"] .theme-badge-success { color: #059669; }
html[data-theme="light"] .theme-badge-danger  { color: #dc2626; }
html[data-theme="light"] .theme-badge-warning { color: #d97706; }
html[data-theme="light"] .theme-badge-info    { color: #2563eb; }
html[data-theme="light"] .theme-badge-accent  { color: var(--accent); }

/* ── Form Inputs (CSS-only alternative to Tailwind $inp) ─── */

.theme-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--stroke-soft);
    border-radius: 1rem;
    color: var(--text-main);
    padding: 0.72rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    appearance: none;
}

.theme-input::placeholder {
    color: var(--text-dim);
}

.theme-input:hover {
    border-color: var(--stroke);
}

.theme-input:focus {
    border-color: var(--stroke);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.theme-input.theme-textarea {
    border-radius: 1.25rem;
    resize: vertical;
    min-height: 6rem;
}

/* Reinforce focus ring with accent for all themed inputs (overrides Tailwind's subtle ring) */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not(.select2-search__field):not(.swal2-input):focus,
select:not(.swal2-select):focus,
textarea:not(.swal2-textarea):focus {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.35rem;
}

.theme-divider {
    border: none;
    border-top: 1px solid var(--stroke-soft);
    margin: 0;
}

#bundle-table_wrapper {
    padding: 0;
}

#bundle-table_wrapper .dt-layout-row {
    margin: 0;
}

#bundle-table_wrapper .dt-layout-row:first-child {
    padding: 1rem 1rem 0.85rem;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--stroke);
}

#bundle-table_wrapper .dt-layout-row:last-child {
    padding: 1rem 1.35rem 1.1rem;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--stroke);
}

#bundle-table_wrapper .dt-layout-cell {
    color: var(--text-muted);
}

#bundle-table_wrapper .dt-layout-start,
#bundle-table_wrapper .dt-layout-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#bundle-table_wrapper .dt-layout-end {
    justify-content: flex-end;
}

#bundle-table_wrapper .dt-layout-row:last-child .dt-layout-cell {
    width: 100%;
}

#bundle-table_wrapper .dt-search label,
#bundle-table_wrapper .dt-length label {
    color: var(--text-muted);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

#bundle-table_wrapper .dt-search input,
#bundle-table_wrapper .dt-length select {
    background: color-mix(in srgb, var(--surface) 100%, transparent);
    border: 1px solid var(--stroke-soft);
    color: var(--text-main);
    border-radius: 999px;
    min-height: 2.5rem;
    padding: 0.45rem 0.95rem;
}

#bundle-table_wrapper .dt-search input {
    width: min(17rem, 100%);
}

#bundle-table_wrapper .dt-search label {
    min-width: 0;
}

#bundle-table_wrapper .dt-info {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

#bundle-table_wrapper .dt-search input:focus,
#bundle-table_wrapper .dt-length select:focus {
    outline: none;
    border-color: var(--stroke);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface-strong) 70%, transparent);
}

#bundle-table_wrapper .dt-paging {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    width: 100%;
    padding-left: 0;
}

#bundle-table_wrapper .dt-paging nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

#bundle-table_wrapper .dt-paging-button {
    border-radius: 999px !important;
    border: 1px solid var(--stroke-soft) !important;
    background: var(--surface) !important;
    color: var(--text-main) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#bundle-table_wrapper .dt-paging-button.current,
#bundle-table_wrapper .dt-paging-button:not(.first):not(.previous):not(.next):not(.last) {
    width: auto;
    min-width: 2.55rem;
    padding: 0 0.78rem !important;
}

#bundle-table_wrapper .dt-paging-button i {
    font-size: 1rem;
    line-height: 1;
}

#bundle-table_wrapper .dt-paging-button.current,
#bundle-table_wrapper .dt-paging-button:hover {
    background: var(--active-bg) !important;
    color: var(--active-text) !important;
    border-color: var(--stroke-soft) !important;
}

#bundle-table_wrapper table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
}

#bundle-table_wrapper table.dataTable thead th,
#bundle-table_wrapper table.dataTable tbody td {
    background: transparent;
    color: inherit;
}

#bundle-table_wrapper table.dataTable thead th {
    border-bottom: 1px solid var(--stroke) !important;
}

#bundle-table_wrapper table.dataTable tbody tr {
    border-top: 1px solid var(--stroke);
}

#bundle-table_wrapper table.dataTable tbody td {
    padding: 10px 10px !important;
    /*border-right: 1px solid var(--stroke);
    vertical-align: middle;*/
}

#bundle-table_wrapper table.dataTable tbody td:last-child,
#bundle-table_wrapper table.dataTable thead th:last-child {
    border-right: none;
}

#bundle-table_wrapper table.dataTable tbody tr.row-selected td {
    background: var(--active-bg) !important;
    color: var(--active-text) !important;
}

#bundle-table_wrapper table.dataTable tbody tr.row-selected {
    cursor: pointer;
}

#bundle-table_wrapper table.dataTable tbody tr:not(.row-selected):hover td {
    background: var(--surface-hover) !important;
}

/* ── Fila inactiva ───────────────────────────────────────────── */

#bundle-table_wrapper table.dataTable tbody tr.row-inactiva td {
    color: #ef4444 !important;
    opacity: 0.65;
    text-decoration: line-through !important;
    text-decoration-color: #ef4444 !important;
}

#bundle-table_wrapper table.dataTable tbody tr.row-inactiva:not(.row-selected):hover td {
    background: var(--surface-hover) !important;
    opacity: 0.85;
}

html[data-theme="light"] #bundle-table_wrapper table.dataTable tbody tr.row-inactiva td {
    color: #dc2626 !important;
    text-decoration-color: #dc2626 !important;
}

.dt-scroll-headInner {
    width: 100% !important;
}

table tbody tr td, table tbody tr th, table thead tr th {
    white-space: nowrap !important;
}
/* ── Numeric table columns ─────────────────────────────────── */

/*
 * Apply to DataTables <th>/<td> via columnDefs className: 'col-num'.
 * tabular-nums aligns decimal points and thousand-separators perfectly.
 * A mono stack gives numbers their own visual weight without competing
 * with the surrounding Inter body text.
 */
.col-num {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    text-align: right !important;
    white-space: nowrap;
}

/* Keep the header label readable — semibold Inter, not mono */
#bundle-table_wrapper table.dataTable thead th.col-num {
    font-family: inherit;
    font-variant-numeric: normal;
    font-weight: 600;
    letter-spacing: normal;
    font-size: 0.875rem;
}

/* Subtle accent on positive amounts in dark mode */
.col-num[data-positive="true"],
.col-num .col-num-positive {
    color: var(--active-text);
}

.bundle-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 0.75rem;
    background: var(--chip);
    color: var(--chip-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.bundle-strong {
    font-weight: 600;
}

.bundle-dim {
    color: var(--text-dim);
}

.bundle-center {
    text-align: center;
}

/* Collapsible sidebar nav */
.nav-section-label {
    padding: 0.5rem 0.75rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.nav-group-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-main);
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
    cursor: pointer;
}

.nav-group-trigger:hover {
    background: var(--surface-hover);
}

.nav-group.has-active > .nav-group-trigger {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.nav-group.has-active > .nav-group-trigger .nav-group-chevron {
    color: var(--nav-active-text);
}

.nav-group-chevron {
    font-size: 1rem;
    line-height: 1;
    color: var(--text-dim);
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

.nav-group.is-open .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.22s ease;
}

.nav-group.is-open .nav-group-content {
    grid-template-rows: 1fr;
}

.nav-group-items {
    overflow: hidden;
    padding: 0.25rem 0 0.25rem 0.5rem;
}

.nav-sub-link {
    display: block;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9375rem;
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease;
    margin-bottom: 0.1rem;
}

.nav-sub-link:hover {
    background: var(--surface-hover);
    color: var(--text-main);
}

.nav-sub-link.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    font-weight: 600;
}

@media (max-width: 768px) {
    #bundle-table_wrapper .dt-layout-row:first-child,
    #bundle-table_wrapper .dt-layout-row:last-child {
        flex-direction: column;
        align-items: stretch;
    }

    #bundle-table_wrapper .dt-layout-start,
    #bundle-table_wrapper .dt-layout-end {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    #bundle-table_wrapper .dt-search,
    #bundle-table_wrapper .dt-search label,
    #bundle-table_wrapper .dt-search input {
        width: 100%;
    }

    #bundle-table_wrapper .dt-search input {
        margin-left: 0 !important;
    }

    #bundle-table_wrapper .dt-paging {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
}

.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22) !important;
}

html[data-theme="light"] .is-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.invalid-feedback {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    margin-top: 0.3rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #ef4444;
    padding-left: 0.25rem;
}

html[data-theme="light"] .invalid-feedback {
    color: #dc2626;
}

/* ── Inner panel dividers ──────────────────────────────────── */
/*
 * Tables and lists inside .theme-panel-soft / .theme-table-body use
 * --stroke-faint (half the opacity of --stroke-soft) so row separators
 * don't overwhelm the content — especially in light mode.
 */

/* thead separator — only manual border-b/y rows (leaves DataTables untouched) */
.theme-panel-soft thead > tr.border-b,
.theme-panel-soft thead > tr.border-y,
.theme-table-body thead > tr.border-b,
.theme-table-body thead > tr.border-y {
    border-color: var(--stroke-faint);
}

/* tbody row dividers  (divide-y inheritance override) */
.theme-panel-soft tbody.divide-y > tr + tr,
.theme-table-body tbody.divide-y > tr + tr {
    border-color: var(--stroke-faint);
}

/* ul / div list dividers inside panels */
.theme-panel-soft ul.divide-y > li + li,
.theme-panel-soft div.divide-y > div + div,
.theme-table-body ul.divide-y > li + li,
.theme-table-body div.divide-y > div + div {
    border-color: var(--stroke-faint);
}

/* ── KPI Card entrance ─────────────────────────────────────── */

@keyframes kpi-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.kpi-card {
    animation: kpi-card-in 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    .kpi-card { animation: none; }
}

/* ── Flash Messages ────────────────────────────────────────── */

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-radius: 1rem;
    border: 1px solid;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    line-height: 1.5;
    cursor: pointer;
    animation: flash-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.flash-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 1.15rem;
    margin-top: 0.05rem;
    line-height: 0;
}

.flash-body {
    flex: 1;
    min-width: 0;
}

.flash-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 0;
    background: transparent;
    opacity: 0.5;
    font-size: 0.9rem;
    line-height: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    cursor: pointer;
}

.flash-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.22);
    color: #a7f3d0;
}

.flash-success .flash-icon { color: #10b981; }

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.flash-error .flash-icon { color: #ef4444; }

.flash-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
}

.flash-warning .flash-icon { color: #f59e0b; }

.flash-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}

.flash-info .flash-icon { color: #3b82f6; }

html[data-theme="light"] .flash-success { color: #065f46; }
html[data-theme="light"] .flash-success .flash-icon { color: #059669; }
html[data-theme="light"] .flash-error { color: #7f1d1d; }
html[data-theme="light"] .flash-error .flash-icon { color: #dc2626; }
html[data-theme="light"] .flash-warning { color: #78350f; }
html[data-theme="light"] .flash-warning .flash-icon { color: #d97706; }
html[data-theme="light"] .flash-info { color: #1e3a5f; }
html[data-theme="light"] .flash-info .flash-icon { color: #2563eb; }

html[data-theme="light"] .flash-close:hover {
    background: rgba(0, 0, 0, 0.07);
}

/* ─── SweetAlert2 Custom Theme ──────────────────────────────── */

/* Popup */
.swal2-popup {
    background: var(--panel) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 30px !important;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24) !important;
    padding: 1.75rem 1.5rem 1.5rem !important;
    color: var(--text-main) !important;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
}

html[data-theme="light"] .swal2-popup {
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.14) !important;
}

.swal2-title {
    color: var(--text-strong) !important;
    font-weight: 600 !important;
    font-size: 1.25rem !important;
    padding: 0 !important;
    margin-bottom: 0.35rem !important;
}

.swal2-html-container {
    color: var(--text-muted) !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ─── Icons ────────────────────────────────────────────────── */

/*
 * Keep SweetAlert2's default em-based sizing so its internal
 * elements (X lines, checkmark, ring) remain proportional.
 * We only adjust margin and border thickness.
 */
.swal2-icon {
    border-width: 3px !important;
    border-style: solid !important;
    margin: 0 auto 1.25rem !important;
}

/* ── Success ── */
.swal2-icon.swal2-success {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.25) !important;
}

.swal2-icon.swal2-success [class^="swal2-success-line"],
.swal2-icon.swal2-success [class*=" swal2-success-line"] {
    background-color: #10b981 !important;
}

/*
 * Mask divs use the popup background to clip the animation circle.
 * Must match --panel or they appear as white boxes in dark mode.
 */
.swal2-icon.swal2-success .swal2-success-circular-line-left,
.swal2-icon.swal2-success .swal2-success-circular-line-right,
.swal2-icon.swal2-success .swal2-success-fix {
    background-color: var(--panel) !important;
}

/* ── Error ── */
.swal2-icon.swal2-error {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/*
 * The X mark lines are red on a near-transparent background.
 * In dark mode red-on-dark has poor contrast, so we use white
 * (same pattern as traffic/alert icons: red circle + white X).
 */
.swal2-icon.swal2-error .swal2-x-mark {
    position: relative !important;
}

.swal2-icon.swal2-error .swal2-x-mark-line-left,
.swal2-icon.swal2-error .swal2-x-mark-line-right {
    background-color: #ef4444 !important;
    border-radius: 3px !important;
}

html[data-theme="light"] .swal2-icon.swal2-error .swal2-x-mark-line-left,
html[data-theme="light"] .swal2-icon.swal2-error .swal2-x-mark-line-right {
    background-color: #dc2626 !important;
}

/* ── Warning ── */
.swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

.swal2-icon.swal2-warning .swal2-icon-content {
    color: #f59e0b !important;
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* Info */
.swal2-icon.swal2-info {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.08) !important;
}

.swal2-icon.swal2-info .swal2-icon-content {
    color: #3b82f6 !important;
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* Question */
.swal2-icon.swal2-question {
    border-color: var(--stroke) !important;
    background: var(--surface) !important;
}

.swal2-icon.swal2-question .swal2-icon-content {
    color: var(--text-muted) !important;
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* ─── Buttons ──────────────────────────────────────────────── */

.swal2-actions {
    gap: 0.6rem !important;
    margin-top: 1.5rem !important;
    padding: 0 !important;
}

.swal2-confirm {
    background: var(--text-main) !important;
    color: var(--panel) !important;
    border-radius: 999px !important;
    padding: 0.7rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    border: 1px solid transparent !important;
    transition: filter 0.18s ease, transform 0.18s ease !important;
    box-shadow: none !important;
}

.swal2-confirm:hover {
    filter: brightness(0.92) !important;
    transform: translateY(-1px) !important;
}

.swal2-confirm:focus {
    box-shadow: none !important;
    outline: none !important;
}

.swal2-cancel {
    background: var(--surface) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 999px !important;
    padding: 0.7rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    transition: background 0.18s ease, border-color 0.18s ease !important;
    box-shadow: none !important;
}

.swal2-cancel:hover {
    background: var(--surface-strong) !important;
    border-color: var(--stroke) !important;
}

.swal2-cancel:focus {
    box-shadow: none !important;
    outline: none !important;
}

.swal2-deny {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
    border-radius: 999px !important;
    padding: 0.7rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    transition: background 0.18s ease !important;
    box-shadow: none !important;
}

.swal2-deny:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

.swal2-deny:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* Close button */
.swal2-close {
    color: var(--text-dim) !important;
    width: 2.25rem !important;
    height: 2.25rem !important;
    border-radius: 50% !important;
    font-size: 1.5rem !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.swal2-close:hover {
    background: var(--surface-hover) !important;
    color: var(--text-main) !important;
}

.swal2-close:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* ─── Form inputs ──────────────────────────────────────────── */

.swal2-input,
.swal2-file {
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 999px !important;
    color: var(--text-main) !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.swal2-input:focus,
.swal2-file:focus {
    border-color: var(--stroke) !important;
    box-shadow: 0 0 0 2px var(--surface-strong) !important;
    outline: none !important;
}

.swal2-input::placeholder {
    color: var(--text-dim) !important;
}

.swal2-textarea {
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 16px !important;
    color: var(--text-main) !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    resize: vertical !important;
}

.swal2-textarea:focus {
    border-color: var(--stroke) !important;
    box-shadow: 0 0 0 2px var(--surface-strong) !important;
    outline: none !important;
}

.swal2-select {
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 999px !important;
    color: var(--text-main) !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
}

.swal2-select:focus {
    border-color: var(--stroke) !important;
    box-shadow: 0 0 0 2px var(--surface-strong) !important;
    outline: none !important;
}

.swal2-checkbox input,
.swal2-radio input {
    accent-color: var(--text-main) !important;
}

.swal2-checkbox label,
.swal2-radio label {
    color: var(--text-muted) !important;
}

.swal2-validation-message {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
    border-radius: 12px !important;
    margin-top: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
}

/* ─── Footer / loader / progress ──────────────────────────── */

.swal2-footer {
    border-top: 1px solid var(--stroke-soft) !important;
    color: var(--text-dim) !important;
    margin-top: 1rem !important;
    padding-top: 1rem !important;
    font-size: 0.875rem !important;
}

.swal2-timer-progress-bar-container {
    border-radius: 0 0 30px 30px !important;
    overflow: hidden !important;
}

.swal2-timer-progress-bar {
    background: var(--stroke) !important;
}

.swal2-loader {
    border-color: var(--stroke-soft) transparent var(--stroke-soft) transparent !important;
}

.swal2-progress-steps {
    gap: 0.5rem !important;
    margin-bottom: 1rem !important;
}

.swal2-progress-step {
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 999px !important;
    color: var(--text-muted) !important;
    width: 2rem !important;
    height: 2rem !important;
    line-height: 2rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
}

.swal2-progress-step-line {
    background: var(--stroke-soft) !important;
    height: 2px !important;
}

.swal2-active-progress-step {
    background: var(--text-main) !important;
    border-color: var(--text-main) !important;
    color: var(--panel) !important;
}

/* ─── Backdrop ─────────────────────────────────────────────── */

.swal2-container.swal2-backdrop-show,
div:where(.swal2-container).swal2-backdrop-show {
    background: rgba(12, 10, 10, 0.48) !important;
    backdrop-filter: blur(4px) !important;
}

html[data-theme="light"] .swal2-container.swal2-backdrop-show,
html[data-theme="light"] div:where(.swal2-container).swal2-backdrop-show {
    background: rgba(28, 22, 18, 0.28) !important;
}

/* ─── Toast ────────────────────────────────────────────────── */

.swal2-popup.swal2-toast {
    border-radius: 16px !important;
    padding: 0.75rem 1rem !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14) !important;
    gap: 0.75rem !important;
}

.swal2-popup.swal2-toast .swal2-icon {
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 !important;
    border-width: 2px !important;
    flex-shrink: 0 !important;
}

.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content {
    font-size: 1rem !important;
}

.swal2-popup.swal2-toast .swal2-title {
    font-size: 0.9375rem !important;
    margin: 0 !important;
}

.swal2-popup.swal2-toast .swal2-html-container {
    font-size: 0.875rem !important;
    margin: 0 !important;
}

/* toast: mask divs also need to match panel */
.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-circular-line-left,
.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-circular-line-right,
.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-fix {
    background-color: var(--panel) !important;
}

/* ─── Select2 Custom Theme ───────────────────────────────────── */

.select2-container { width: 100% !important; }

/* ── Trigger field ────────────────────────────────────────────── */

.select2-container--default .select2-selection {
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 1rem !important;
    min-height: 3.1rem !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.select2-container--default .select2-selection:hover {
    border-color: var(--stroke) !important;
}

.select2-container--default.select2-container--focus .select2-selection,
.select2-container--default.select2-container--open .select2-selection {
    border-color: var(--stroke) !important;
    box-shadow: 0 0 0 2px var(--surface-strong) !important;
}

/* Single select layout */
.select2-container--default .select2-selection--single {
    display: flex !important;
    align-items: center !important;
    padding: 0 2.75rem 0 1rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main) !important;
    font-size: 0.9375rem !important;
    line-height: 1 !important;
    padding: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-dim) !important;
}

/* ── Arrow ─── */
/* Hide Select2's default <b> arrow */
.select2-container--default .select2-selection__arrow b {
    display: none !important;
}

.select2-container--default .select2-selection__arrow {
    position: absolute !important;
    right: 0.85rem !important;
    top: 50% !important;
    height: 1.25rem !important;
    width: 1.25rem !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* SVG chevron icon via background-image — works in both themes */
.select2-container--default .select2-selection__arrow::after {
    content: "" !important;
    display: block !important;
    width: 1.1rem !important;
    height: 1.1rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a49a94' d='M4.22 8.47a.75.75 0 0 1 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    transition: transform 0.2s ease !important;
}

.select2-container--default.select2-container--open .select2-selection__arrow::after {
    transform: rotate(180deg) !important;
}

/* ── Clear (×) button ─── */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 2.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--text-dim) !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    width: 1.4rem !important;
    height: 1.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: background 0.15s ease, color 0.15s ease !important;
    margin: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    background: var(--surface-hover) !important;
    color: var(--text-main) !important;
}

/* ── Dropdown panel ───────────────────────────────────────────── */

.select2-dropdown {
    background: var(--panel) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22) !important;
    overflow: hidden !important;
    padding: 0.35rem !important;
}

html[data-theme="light"] .select2-dropdown {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1) !important;
}

/* ── Search field ─── */
.select2-container--default .select2-search--dropdown {
    padding: 0.4rem !important;
    margin-bottom: 0.2rem !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    width: 100% !important;
    background: var(--surface) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 999px !important;
    color: var(--text-main) !important;
    padding: 0.5rem 0.9rem !important;
    font-size: 0.9rem !important;
    font-family: inherit !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--stroke) !important;
    box-shadow: 0 0 0 2px var(--surface-strong) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--text-dim) !important;
}

/* ── Options list ─────────────────────────────────────────────── */

.select2-container--default .select2-results__options {
    max-height: 14rem !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: var(--scroll-thumb) transparent !important;
    padding: 0 !important;
}

.select2-container--default .select2-results__options::-webkit-scrollbar { width: 5px !important; }
.select2-container--default .select2-results__options::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb) !important;
    border-radius: 999px !important;
}

/* Base option */
.select2-container--default .select2-results__option {
    color: var(--text-muted) !important;
    background: transparent !important;
    padding: 0.55rem 0.9rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.9375rem !important;
    margin-bottom: 2px !important;
    cursor: pointer !important;
    transition: background 0.12s ease, color 0.12s ease !important;
}

.select2-container--default .select2-results__option:last-child { margin-bottom: 0 !important; }

/*
 * State cascade — order + specificity matters here.
 * 1) Base hover/highlight (keyboard nav)
 * 2) Currently selected value  ← needs accent color
 * 3) Selected + highlighted    ← wins via higher specificity
 */

/* 1 — Highlighted (hover / keyboard focus) */
.select2-container--default .select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--active-bg) !important;
    color: var(--active-text) !important;
}

/* 2 — Currently selected value */
.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option--selected {
    background: var(--nav-active-bg) !important;
    color: var(--nav-active-text) !important;
    font-weight: 600 !important;
}

/*
 * 3 — Selected + highlighted: explicit rule with attribute selector
 * gives this one higher specificity (2 classes + 1 attr > 1 class),
 * so it wins over rule 1 even when the item is focused on open.
 */
.select2-container--default .select2-results__option--highlighted[aria-selected="true"],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selected {
    background: var(--nav-active-bg) !important;
    color: var(--nav-active-text) !important;
    font-weight: 600 !important;
    filter: brightness(1.08) !important;
}

/* Group label */
.select2-container--default .select2-results__group {
    color: var(--text-dim) !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 0.5rem 0.9rem 0.3rem !important;
}

/* "No results" message */
.select2-container--default .select2-results__message,
.select2-results__option-more {
    color: var(--text-dim) !important;
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
    text-align: center !important;
    font-style: italic !important;
    cursor: default !important;
}

/* Disabled */
.select2-container--default.select2-container--disabled .select2-selection {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ── Multi-select ─────────────────────────────────────────────── */

.select2-container--default .select2-selection--multiple {
    background: var(--surface) !important;
    border-radius: 1.25rem !important;
    padding: 0.3rem 2.5rem 0.3rem 0.6rem !important;
    min-height: 2.85rem !important;
    display: flex !important;
    align-items: flex-start !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.3rem !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--chip) !important;
    color: var(--chip-text) !important;
    border: none !important;
    border-radius: 999px !important;
    padding: 0.22rem 0.55rem 0.22rem 0.7rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    line-height: 1.4 !important;
    max-width: 14rem !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--chip-text) !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 1rem !important;
    height: 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.6 !important;
    order: 1 !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
    transition: opacity 0.15s ease, background 0.15s ease !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    opacity: 1 !important;
    background: rgba(0,0,0,0.12) !important;
}

/* Inline search input (multi) */
.select2-container--default .select2-search--inline {
    display: flex !important;
    flex: 1 !important;
    min-width: 4rem !important;
}

.select2-container--default .select2-search--inline .select2-search__field {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--text-main) !important;
    font-size: 0.9375rem !important;
    font-family: inherit !important;
    padding: 0.22rem 0.25rem !important;
    margin: 0 !important;
    width: 100% !important;
    box-shadow: none !important;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: var(--text-dim) !important;
}

/* ── Validation ─── */
.select2-container--default.is-invalid .select2-selection {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
}

.select2-container .select2-selection--single:focus,
.select2-container .select2-selection--multiple:focus {
    outline: none !important;
}

/* ══════════════════════════════════════════════════════════════════════
   Flatpickr — Tema personalizado (usa variables del proyecto)
   ══════════════════════════════════════════════════════════════════════ */

/* Input con clase fp-date — cursor pointer para indicar que abre calendario */
input.fp-date,
input.fp-date.flatpickr-input {
    cursor: pointer;
}

/* Calendario flotante */
.flatpickr-calendar {
    background: var(--panel) !important;
    border: 1px solid var(--stroke) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22) !important;
    font-family: inherit !important;
    padding: 0.3rem !important;
    /*width: 290px !important;*/
}
.flatpickr-calendar.open {
    animation: fp-fadein 0.15s ease;
}
@keyframes fp-fadein {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Triángulo / flecha — ocultar */
.flatpickr-calendar::before,
.flatpickr-calendar::after {
    display: none !important;
}

/* Cabecera de meses */
.flatpickr-months {
    padding: 0.25rem 0.25rem 0.15rem !important;
    align-items: center !important;
}
.flatpickr-months .flatpickr-month {
    background: transparent !important;
    color: var(--text-strong) !important;
    height: 2.2rem !important;
    fill: var(--text-strong) !important;
}
.flatpickr-current-month {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--text-strong) !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.15rem !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    width: 100%;
    background: var(--panel-soft) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 0.5rem !important;
    font-weight: 600 !important;
    font-size: 0.88rem !important;
    padding: 0.5rem 0.4rem !important;
    cursor: pointer !important;
    appearance: none !important;
}
.flatpickr-current-month .numInputWrapper {
    /*width: 4.5rem !important;*/
    width: 100% !important;
}
.flatpickr-current-month input.numInput {
    background: var(--panel-soft) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--stroke-soft) !important;
    border-radius: 0.5rem !important;
    font-weight: 600 !important;
    font-size: 0.88rem !important;
    padding: 0.44rem 0.4rem !important;
    width: 100% !important;
}
.flatpickr-current-month input.numInput:focus {
    outline: none !important;
    border-color: var(--accent) !important;
}
.numInputWrapper span.arrowUp,
.numInputWrapper span.arrowDown {
    border-color: var(--text-dim) transparent !important;
}
.numInputWrapper span.arrowUp::after {
    border-bottom-color: var(--text-muted) !important;
}
.numInputWrapper span.arrowDown::after {
    border-top-color: var(--text-muted) !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: var(--text-muted) !important;
    color: var(--text-muted) !important;
    padding: 0.35rem !important;
    border-radius: 50% !important;
    height: 2rem !important;
    width: 2rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    top: 8% !important;
    transform: translateY(-50%) !important;
    transition: background 0.15s, fill 0.15s !important;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: var(--surface-strong) !important;
    fill: var(--text-main) !important;
    color: var(--text-main) !important;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    width: 0.9rem !important;
    height: 0.9rem !important;
}

/* Nombres de días de la semana */
.flatpickr-weekdays {
    background: transparent !important;
    margin-top: 0.35rem !important;
}
span.flatpickr-weekday {
    background: transparent !important;
    color: var(--text-dim) !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}

/* Celdas de días */
.flatpickr-days {
    border: none !important;
    width: 100% !important;
}
.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}
.flatpickr-day {
    display: inline-flex !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    color: var(--text-main) !important;
    font-size: 0.82rem !important;
    /*height: 2.1rem !important;*/
    line-height: 2.1rem !important;
    /*max-width: 2.1rem !important;*/
    transition: background 0.12s, color 0.12s !important;
}
.flatpickr-day:hover,
.flatpickr-day:focus {
    background: var(--surface-strong) !important;
    border: none !important;
    color: var(--text-main) !important;
    outline: none !important;
}
.flatpickr-day.today {
    border: 1.5px solid var(--accent) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
}
.flatpickr-day.today:hover {
    background: var(--accent-soft) !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--primary-btn-text) !important;
    font-weight: 700 !important;
}
.flatpickr-day.inRange {
    background: var(--accent-soft) !important;
    border-color: transparent !important;
    color: var(--text-main) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-dim) !important;
    opacity: 0.45 !important;
}
.flatpickr-day.flatpickr-disabled:hover {
    background: transparent !important;
}

/* Botones de la barra inferior (con confirmación) */
.flatpickr-confirm {
    background: transparent !important;
}

