/*
 * Bootstrap / Metronic components in monday's shape (spec §6.1). Colours come only from
 * core/theme.css; most already arrive through the --bs-* mapping there, so this file is
 * mostly radius, height, borders and weight. !important appears only where the Metronic
 * rule being replaced uses it.
 */

/* Buttons ------------------------------------------------------------------------ */

.btn {
    border-radius: var(--ui-r-sm);
    font-weight: 500;
}

.btn:not(.btn-icon):not(.btn-link):not(.btn-sm):not(.btn-lg) {
    min-height: 40px;
}

.btn.btn-sm:not(.btn-icon) {
    min-height: 32px;
}

.btn.btn-lg:not(.btn-icon) {
    min-height: 48px;
}

.btn.btn-light,
.btn.btn-secondary {
    background-color: transparent;
    color: var(--ui-text);
}

/* Metronic strips the border from every .btn that is not outline/dashed/flush/icon, with
   a selector eight classes deep; the outlined look needs !important to survive it. */
.btn.btn-light:not(.btn-icon),
.btn.btn-secondary:not(.btn-icon) {
    border: 1px solid var(--ui-border-strong) !important;
}

/* Metronic pads a borderless button 1px more per side to make up for `border: 0`; the
   border above would double that, 2px taller than every other control. Bordered buttons
   take Metronic's own padding variables (.btn-sm / .btn-lg set them). Same selector shape
   as Metronic's, so the specificity ties for sm/lg and wins for the default size. */
.btn.btn-light:not(.btn-outline):not(.btn-dashed):not(.btn-bordered):not(.border-hover):not(.border-active):not(.btn-flush):not(.btn-icon):not(.btn-hover-outline),
.btn.btn-secondary:not(.btn-outline):not(.btn-dashed):not(.btn-bordered):not(.border-hover):not(.border-active):not(.btn-flush):not(.btn-icon):not(.btn-hover-outline) {
    padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
}

.btn-check:checked + .btn.btn-light,
.btn-check:active + .btn.btn-light,
.btn.btn-light:focus:not(.btn-active),
.btn.btn-light:hover:not(.btn-active),
.btn.btn-light:active:not(.btn-active),
.btn.btn-light.active,
.btn.btn-light.show,
.show > .btn.btn-light,
.btn-check:checked + .btn.btn-secondary,
.btn-check:active + .btn.btn-secondary,
.btn.btn-secondary:focus:not(.btn-active),
.btn.btn-secondary:hover:not(.btn-active),
.btn.btn-secondary:active:not(.btn-active),
.btn.btn-secondary.active,
.btn.btn-secondary.show,
.show > .btn.btn-secondary {
    border-color: var(--ui-border-strong);
    background-color: var(--ui-hover) !important;
    color: var(--ui-text);
}

/* Metronic repaints .btn-secondary near-black in dark (one class more than the rules above,
   and the hover fill is !important); same declarations, one attribute selector heavier. */
[data-bs-theme="dark"] .btn.btn-secondary {
    background-color: transparent;
    color: var(--ui-text);
}

[data-bs-theme="dark"] .btn-check:checked + .btn.btn-secondary,
[data-bs-theme="dark"] .btn-check:active + .btn.btn-secondary,
[data-bs-theme="dark"] .btn.btn-secondary:focus:not(.btn-active),
[data-bs-theme="dark"] .btn.btn-secondary:hover:not(.btn-active),
[data-bs-theme="dark"] .btn.btn-secondary:active:not(.btn-active),
[data-bs-theme="dark"] .btn.btn-secondary.active,
[data-bs-theme="dark"] .btn.btn-secondary.show,
[data-bs-theme="dark"] .show > .btn.btn-secondary {
    border-color: var(--ui-border-strong);
    background-color: var(--ui-hover) !important;
    color: var(--ui-text);
}

.btn.btn-light-primary,
.btn.btn-light-success,
.btn.btn-light-warning,
.btn.btn-light-danger,
.btn.btn-light-info,
.btn.btn-light-dark {
    border-color: transparent;
    background-color: transparent;
}

.btn.btn-light-primary,
.btn.btn-light-primary i { color: var(--ui-tone-primary-ink); }
.btn.btn-light-success,
.btn.btn-light-success i { color: var(--ui-tone-success-ink); }
.btn.btn-light-warning,
.btn.btn-light-warning i { color: var(--ui-tone-warning-ink); }
.btn.btn-light-danger,
.btn.btn-light-danger i { color: var(--ui-tone-danger-ink); }
.btn.btn-light-info,
.btn.btn-light-info i { color: var(--ui-tone-info-ink); }
.btn.btn-light-dark,
.btn.btn-light-dark i { color: var(--ui-tone-dark-ink); }

/* Ghost buttons in their hover / active / open states. Metronic turns them into a solid
   fill with --bs-<t>-inverse text and icons (white on the soft tint here); keep the soft
   tint and the tone's ink for the text, the icons and the dropdown caret, over Metronic's
   full state list so no state falls through. */
.btn-check:checked + .btn.btn-light-primary,
.btn-check:active + .btn.btn-light-primary,
.btn.btn-light-primary:focus:not(.btn-active),
.btn.btn-light-primary:hover:not(.btn-active),
.btn.btn-light-primary:active:not(.btn-active),
.btn.btn-light-primary.active,
.btn.btn-light-primary.show,
.show > .btn.btn-light-primary {
    background-color: var(--ui-tone-primary-soft) !important;
    color: var(--ui-tone-primary-ink);
}

.btn-check:checked + .btn.btn-light-primary i,
.btn-check:checked + .btn.btn-light-primary .svg-icon,
.btn-check:active + .btn.btn-light-primary i,
.btn-check:active + .btn.btn-light-primary .svg-icon,
.btn.btn-light-primary:focus:not(.btn-active) i,
.btn.btn-light-primary:focus:not(.btn-active) .svg-icon,
.btn.btn-light-primary:hover:not(.btn-active) i,
.btn.btn-light-primary:hover:not(.btn-active) .svg-icon,
.btn.btn-light-primary:active:not(.btn-active) i,
.btn.btn-light-primary:active:not(.btn-active) .svg-icon,
.btn.btn-light-primary.active i,
.btn.btn-light-primary.active .svg-icon,
.btn.btn-light-primary.show i,
.btn.btn-light-primary.show .svg-icon,
.show > .btn.btn-light-primary i,
.show > .btn.btn-light-primary .svg-icon,
.btn-check:checked + .btn.btn-light-primary.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-primary.dropdown-toggle:after,
.btn.btn-light-primary:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-primary:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-primary:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-primary.active.dropdown-toggle:after,
.btn.btn-light-primary.show.dropdown-toggle:after,
.show > .btn.btn-light-primary.dropdown-toggle:after {
    color: var(--ui-tone-primary-ink);
}

.btn-check:checked + .btn.btn-light-success,
.btn-check:active + .btn.btn-light-success,
.btn.btn-light-success:focus:not(.btn-active),
.btn.btn-light-success:hover:not(.btn-active),
.btn.btn-light-success:active:not(.btn-active),
.btn.btn-light-success.active,
.btn.btn-light-success.show,
.show > .btn.btn-light-success {
    background-color: var(--ui-tone-success-soft) !important;
    color: var(--ui-tone-success-ink);
}

.btn-check:checked + .btn.btn-light-success i,
.btn-check:checked + .btn.btn-light-success .svg-icon,
.btn-check:active + .btn.btn-light-success i,
.btn-check:active + .btn.btn-light-success .svg-icon,
.btn.btn-light-success:focus:not(.btn-active) i,
.btn.btn-light-success:focus:not(.btn-active) .svg-icon,
.btn.btn-light-success:hover:not(.btn-active) i,
.btn.btn-light-success:hover:not(.btn-active) .svg-icon,
.btn.btn-light-success:active:not(.btn-active) i,
.btn.btn-light-success:active:not(.btn-active) .svg-icon,
.btn.btn-light-success.active i,
.btn.btn-light-success.active .svg-icon,
.btn.btn-light-success.show i,
.btn.btn-light-success.show .svg-icon,
.show > .btn.btn-light-success i,
.show > .btn.btn-light-success .svg-icon,
.btn-check:checked + .btn.btn-light-success.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-success.dropdown-toggle:after,
.btn.btn-light-success:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-success:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-success:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-success.active.dropdown-toggle:after,
.btn.btn-light-success.show.dropdown-toggle:after,
.show > .btn.btn-light-success.dropdown-toggle:after {
    color: var(--ui-tone-success-ink);
}

.btn-check:checked + .btn.btn-light-warning,
.btn-check:active + .btn.btn-light-warning,
.btn.btn-light-warning:focus:not(.btn-active),
.btn.btn-light-warning:hover:not(.btn-active),
.btn.btn-light-warning:active:not(.btn-active),
.btn.btn-light-warning.active,
.btn.btn-light-warning.show,
.show > .btn.btn-light-warning {
    background-color: var(--ui-tone-warning-soft) !important;
    color: var(--ui-tone-warning-ink);
}

.btn-check:checked + .btn.btn-light-warning i,
.btn-check:checked + .btn.btn-light-warning .svg-icon,
.btn-check:active + .btn.btn-light-warning i,
.btn-check:active + .btn.btn-light-warning .svg-icon,
.btn.btn-light-warning:focus:not(.btn-active) i,
.btn.btn-light-warning:focus:not(.btn-active) .svg-icon,
.btn.btn-light-warning:hover:not(.btn-active) i,
.btn.btn-light-warning:hover:not(.btn-active) .svg-icon,
.btn.btn-light-warning:active:not(.btn-active) i,
.btn.btn-light-warning:active:not(.btn-active) .svg-icon,
.btn.btn-light-warning.active i,
.btn.btn-light-warning.active .svg-icon,
.btn.btn-light-warning.show i,
.btn.btn-light-warning.show .svg-icon,
.show > .btn.btn-light-warning i,
.show > .btn.btn-light-warning .svg-icon,
.btn-check:checked + .btn.btn-light-warning.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-warning.dropdown-toggle:after,
.btn.btn-light-warning:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-warning:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-warning:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-warning.active.dropdown-toggle:after,
.btn.btn-light-warning.show.dropdown-toggle:after,
.show > .btn.btn-light-warning.dropdown-toggle:after {
    color: var(--ui-tone-warning-ink);
}

.btn-check:checked + .btn.btn-light-danger,
.btn-check:active + .btn.btn-light-danger,
.btn.btn-light-danger:focus:not(.btn-active),
.btn.btn-light-danger:hover:not(.btn-active),
.btn.btn-light-danger:active:not(.btn-active),
.btn.btn-light-danger.active,
.btn.btn-light-danger.show,
.show > .btn.btn-light-danger {
    background-color: var(--ui-tone-danger-soft) !important;
    color: var(--ui-tone-danger-ink);
}

.btn-check:checked + .btn.btn-light-danger i,
.btn-check:checked + .btn.btn-light-danger .svg-icon,
.btn-check:active + .btn.btn-light-danger i,
.btn-check:active + .btn.btn-light-danger .svg-icon,
.btn.btn-light-danger:focus:not(.btn-active) i,
.btn.btn-light-danger:focus:not(.btn-active) .svg-icon,
.btn.btn-light-danger:hover:not(.btn-active) i,
.btn.btn-light-danger:hover:not(.btn-active) .svg-icon,
.btn.btn-light-danger:active:not(.btn-active) i,
.btn.btn-light-danger:active:not(.btn-active) .svg-icon,
.btn.btn-light-danger.active i,
.btn.btn-light-danger.active .svg-icon,
.btn.btn-light-danger.show i,
.btn.btn-light-danger.show .svg-icon,
.show > .btn.btn-light-danger i,
.show > .btn.btn-light-danger .svg-icon,
.btn-check:checked + .btn.btn-light-danger.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-danger.dropdown-toggle:after,
.btn.btn-light-danger:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-danger:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-danger:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-danger.active.dropdown-toggle:after,
.btn.btn-light-danger.show.dropdown-toggle:after,
.show > .btn.btn-light-danger.dropdown-toggle:after {
    color: var(--ui-tone-danger-ink);
}

.btn-check:checked + .btn.btn-light-info,
.btn-check:active + .btn.btn-light-info,
.btn.btn-light-info:focus:not(.btn-active),
.btn.btn-light-info:hover:not(.btn-active),
.btn.btn-light-info:active:not(.btn-active),
.btn.btn-light-info.active,
.btn.btn-light-info.show,
.show > .btn.btn-light-info {
    background-color: var(--ui-tone-info-soft) !important;
    color: var(--ui-tone-info-ink);
}

.btn-check:checked + .btn.btn-light-info i,
.btn-check:checked + .btn.btn-light-info .svg-icon,
.btn-check:active + .btn.btn-light-info i,
.btn-check:active + .btn.btn-light-info .svg-icon,
.btn.btn-light-info:focus:not(.btn-active) i,
.btn.btn-light-info:focus:not(.btn-active) .svg-icon,
.btn.btn-light-info:hover:not(.btn-active) i,
.btn.btn-light-info:hover:not(.btn-active) .svg-icon,
.btn.btn-light-info:active:not(.btn-active) i,
.btn.btn-light-info:active:not(.btn-active) .svg-icon,
.btn.btn-light-info.active i,
.btn.btn-light-info.active .svg-icon,
.btn.btn-light-info.show i,
.btn.btn-light-info.show .svg-icon,
.show > .btn.btn-light-info i,
.show > .btn.btn-light-info .svg-icon,
.btn-check:checked + .btn.btn-light-info.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-info.dropdown-toggle:after,
.btn.btn-light-info:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-info:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-info:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-info.active.dropdown-toggle:after,
.btn.btn-light-info.show.dropdown-toggle:after,
.show > .btn.btn-light-info.dropdown-toggle:after {
    color: var(--ui-tone-info-ink);
}

.btn-check:checked + .btn.btn-light-dark,
.btn-check:active + .btn.btn-light-dark,
.btn.btn-light-dark:focus:not(.btn-active),
.btn.btn-light-dark:hover:not(.btn-active),
.btn.btn-light-dark:active:not(.btn-active),
.btn.btn-light-dark.active,
.btn.btn-light-dark.show,
.show > .btn.btn-light-dark {
    background-color: var(--ui-tone-dark-soft) !important;
    color: var(--ui-tone-dark-ink);
}

.btn-check:checked + .btn.btn-light-dark i,
.btn-check:checked + .btn.btn-light-dark .svg-icon,
.btn-check:active + .btn.btn-light-dark i,
.btn-check:active + .btn.btn-light-dark .svg-icon,
.btn.btn-light-dark:focus:not(.btn-active) i,
.btn.btn-light-dark:focus:not(.btn-active) .svg-icon,
.btn.btn-light-dark:hover:not(.btn-active) i,
.btn.btn-light-dark:hover:not(.btn-active) .svg-icon,
.btn.btn-light-dark:active:not(.btn-active) i,
.btn.btn-light-dark:active:not(.btn-active) .svg-icon,
.btn.btn-light-dark.active i,
.btn.btn-light-dark.active .svg-icon,
.btn.btn-light-dark.show i,
.btn.btn-light-dark.show .svg-icon,
.show > .btn.btn-light-dark i,
.show > .btn.btn-light-dark .svg-icon,
.btn-check:checked + .btn.btn-light-dark.dropdown-toggle:after,
.btn-check:active + .btn.btn-light-dark.dropdown-toggle:after,
.btn.btn-light-dark:focus:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-dark:hover:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-dark:active:not(.btn-active).dropdown-toggle:after,
.btn.btn-light-dark.active.dropdown-toggle:after,
.btn.btn-light-dark.show.dropdown-toggle:after,
.show > .btn.btn-light-dark.dropdown-toggle:after {
    color: var(--ui-tone-dark-ink);
}

/* Outline buttons: Metronic paints their hover/active text with --bs-<t>-active, a fill
   colour; on the soft hover background it must be the tone's ink instead. Metronic's rule
   is `.btn.btn-outline.btn-outline-<t>` (not !important on color), so these match it
   class for class and win by loading later. */
.btn-check:checked + .btn.btn-outline.btn-outline-primary,
.btn-check:active + .btn.btn-outline.btn-outline-primary,
.btn.btn-outline.btn-outline-primary:hover:not(.btn-active),
.btn.btn-outline.btn-outline-primary:focus:not(.btn-active),
.btn.btn-outline.btn-outline-primary:active:not(.btn-active),
.btn.btn-outline.btn-outline-primary.active,
.btn.btn-outline.btn-outline-primary.show,
.show > .btn.btn-outline.btn-outline-primary { color: var(--ui-tone-primary-ink); }
.btn-check:checked + .btn.btn-outline.btn-outline-danger,
.btn-check:active + .btn.btn-outline.btn-outline-danger,
.btn.btn-outline.btn-outline-danger:hover:not(.btn-active),
.btn.btn-outline.btn-outline-danger:focus:not(.btn-active),
.btn.btn-outline.btn-outline-danger:active:not(.btn-active),
.btn.btn-outline.btn-outline-danger.active,
.btn.btn-outline.btn-outline-danger.show,
.show > .btn.btn-outline.btn-outline-danger { color: var(--ui-tone-danger-ink); }

.btn:focus-visible {
    outline: 2px solid var(--ui-primary) !important; /* Metronic: .btn { outline: none !important } */
    outline-offset: 2px !important;
}

/* btn-active-light-<tone> (spec §6.1): Metronic writes these buttons' hover / active / open
   text and icons in var(--bs-<t>), the tone's fill, below AA on the soft tint. On the button,
   that variable names the tone's ink; the soft fill has a variable of its own. */
.btn.btn-active-light-primary { --bs-primary: var(--ui-tone-primary-ink); }
.btn.btn-active-light-success { --bs-success: var(--ui-tone-success-ink); }
.btn.btn-active-light-warning { --bs-warning: var(--ui-tone-warning-ink); }
.btn.btn-active-light-danger { --bs-danger: var(--ui-tone-danger-ink); }
.btn.btn-active-light-info { --bs-info: var(--ui-tone-info-ink); }

/* Inputs + selects ----------------------------------------------------------------- */

.form-control,
.form-select,
.form-control.form-control-solid,
.form-select.form-select-solid {
    border: 1px solid var(--ui-border-strong);
    border-radius: var(--ui-r-sm);
    background-color: var(--ui-raised);
    color: var(--ui-text);
}

.form-control:not(textarea):not(.form-control-sm):not(.form-control-lg),
.form-select:not([multiple]):not(.form-select-sm):not(.form-select-lg) {
    min-height: 40px;
}

.form-control.form-control-sm,
.form-select.form-select-sm {
    min-height: 32px;
}

.form-control:hover:not(:disabled):not([readonly]):not(:focus):not(.is-invalid),
.form-select:hover:not(:disabled):not(:focus):not(.is-invalid) {
    border-color: var(--ui-text-2);
}

.form-control:focus,
.form-select:focus,
.form-control.form-control-solid:focus,
.form-select.form-select-solid:focus,
.form-control.form-control-solid.active,
.form-select.form-select-solid.active {
    border-color: var(--ui-primary);
    background-color: var(--ui-raised);
    box-shadow: 0 0 0 3px var(--ui-focus-ring);
    color: var(--ui-text);
}

/* A placeholder is text the person reads: --ui-text-2, which holds AA on the field. */
.form-control::placeholder,
.form-control.form-control-solid::placeholder {
    color: var(--ui-text-2);
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: var(--ui-sunken);
    color: var(--ui-text-2);
}

.form-label {
    color: var(--ui-text);
    font-weight: 500;
}

.form-check-input {
    border-color: var(--ui-border-strong);
    background-color: var(--ui-raised);
}

.form-check:not(.form-switch) .form-check-input[type="checkbox"] {
    border-radius: var(--ui-r-sm);
}

.form-check-input:checked {
    border-color: var(--ui-primary);
    background-color: var(--ui-primary);
}

.form-check-input:focus {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px var(--ui-focus-ring);
}

/* Select2 (Metronic bootstrap5 theme) */

.select2-container--bootstrap5 .select2-dropdown {
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-r-md);
    background-color: var(--ui-raised);
    box-shadow: var(--ui-sh-md);
}

.select2-container--bootstrap5 .select2-dropdown .select2-results__option.select2-results__option--highlighted {
    background-color: var(--ui-primary-highlight);
    color: var(--ui-text);
}

.select2-container--bootstrap5 .select2-dropdown .select2-results__option.select2-results__option--selected {
    background-color: var(--ui-primary-selected);
    color: var(--ui-text);
}

/* Select2 RTL — carried over from the retired brand stylesheet: Metronic's bootstrap5
   theme positions the clear/check/remove icons with physical `right`, wrong when only
   <html> is RTL. */
[dir="rtl"] .select2-container--bootstrap5 .select2-selection__clear { left: 3rem; right: auto; }
[dir="rtl"] .select2-container--bootstrap5 .select2-dropdown .select2-results__option.select2-results__option--selected:after { left: 1.25rem; right: auto; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice .select2-selection__choice__remove { left: auto; right: 0.2rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple.form-select-sm .select2-selection__choice .select2-selection__choice__display { margin-left: 0; margin-right: 0.95rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple:not(.form-select-sm):not(.form-select-lg) .select2-selection__choice .select2-selection__choice__display { margin-left: 0; margin-right: 1.1rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple.form-select-lg .select2-selection__choice .select2-selection__choice__display { margin-left: 0; margin-right: 1.25rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple.form-select-sm .select2-selection__choice { margin-right: 0; margin-left: 0.35rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple:not(.form-select-sm):not(.form-select-lg) .select2-selection__choice { margin-right: 0; margin-left: 0.5rem; }
[dir="rtl"] .select2-container--bootstrap5 .select2-selection--multiple.form-select-lg .select2-selection__choice { margin-right: 0; margin-left: 0.65rem; }
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__clear { float: left; margin-left: 20px; margin-right: 0; }
[dir="rtl"] .select2-container--default .select2-selection--multiple .select2-selection__clear { left: 0; right: auto; margin-left: 10px; margin-right: 0; }
[dir="rtl"] .select2-container--default .select2-selection--multiple.select2-selection--clearable { padding-left: 25px; padding-right: 5px; }

/* Cards ---------------------------------------------------------------------------- */

.card {
    --bs-card-bg: var(--ui-raised);
    --bs-card-border-color: var(--ui-border);
    --bs-card-border-radius: var(--ui-r-md);
    --bs-card-inner-border-radius: calc(var(--ui-r-md) - 1px);
    --bs-card-box-shadow: none;
    --bs-card-cap-bg: transparent;
}

/* A card on the white board needs an edge: views write `border-0 shadow-sm` (both
   Metronic !important utilities), which on a white panel makes the card vanish. */
#kt_app_main .card:not(.ui-board-toolbar) {
    border: 1px solid var(--ui-border) !important;
    box-shadow: none !important;
}

/* Metronic has no .min-w-0, yet dozens of views put it on the flex items that must shrink
   (and let a .text-truncate title inside them truncate). */
.min-w-0 {
    min-width: 0 !important;
}

/* A vertical card header is one column. Metronic's `.card .card-header { flex-wrap: wrap }`
   makes it a multi-line flexbox whose line takes its widest child's one-line width, so a
   long title widened the page on a phone. One line keeps every row at the card's width. */
.card .card-header.flex-column {
    flex-wrap: nowrap;
}

/* Modals -------------------------------------------------------------------------- */

.modal-content {
    --bs-modal-bg: var(--ui-raised);
    border: 0;
    border-radius: var(--ui-r-lg);
    box-shadow: var(--ui-sh-md);
}

.modal-header {
    padding: 20px 24px 8px;
    border-bottom: 0;
}

.modal-title {
    color: var(--ui-text);
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 12px 24px 20px;
}

.modal-footer {
    gap: 8px;
    padding: 8px 24px 20px;
    border-top: 0;
}

/* Every modal fits the screen: each .modal-dialog is .modal-dialog-scrollable, so the
   header and the save buttons stay in view and the body scrolls (ModalViewportTest). Where
   a form (or a .form div) wraps the header, body and footer, it sits between .modal-content
   and the body and must carry the content's column, or the body grows past the dialog and
   the footer is clipped out of reach. */
.modal-content > form,
.modal-content > .form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-block-size: 0;
}

/* ما الجديد — one release's items (core/partials/release_items.php), on the page and in
   the one-time pop-up (core/partials/whats_new_modal.php). ------------------------- */

.ui-wn-groups {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    container-type: inline-size;
}

.ui-wn-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

/* Room for a label column (the page's cards, not the pop-up): each group's label sits
   beside its items, the groups divided by a hairline. */
@container (min-width: 520px) {
    .ui-wn-group {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
        align-items: start;
        gap: 0 16px;
    }

    .ui-wn-group + .ui-wn-group {
        padding-block-start: 0.9rem;
        border-block-start: 1px solid var(--ui-border-soft);
    }

    .ui-wn-group > .ui-wn-tag {
        justify-self: start;
        margin-block-start: 2px;
    }
}

.ui-wn-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 2px 10px;
    border-radius: 999px;
    font: 600 12px/1.6 var(--ui-font);
    white-space: nowrap;
}

.ui-wn-tag i {
    color: inherit;
    font-size: 11px;
}

.ui-wn-tag--success { background: var(--ui-tone-success-soft); color: var(--ui-tone-success-ink); }
.ui-wn-tag--info    { background: var(--ui-tone-info-soft);    color: var(--ui-tone-info-ink); }
.ui-wn-tag--neutral { background: var(--ui-tone-neutral-soft); color: var(--ui-tone-neutral-ink); }
.ui-wn-tag--primary { background: var(--ui-tone-primary-soft); color: var(--ui-tone-primary-ink); }

.ui-wn-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-self: stretch;
    margin: 0;
    padding-inline-start: 1.1rem;
    list-style: disc;
    color: var(--ui-text);
    font-size: 14px;
    line-height: 1.7;
}

.ui-wn-item::marker {
    color: var(--ui-text-3);
}

/* Each bullet takes its group's tone, so a long list still reads as جديد or إصلاح. */
.ui-wn-group--success .ui-wn-item::marker { color: var(--ui-tone-success-ink); }
.ui-wn-group--info .ui-wn-item::marker    { color: var(--ui-tone-info-ink); }

.ui-wn-item__open {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-inline-start: 0.5rem;
    color: var(--ui-link);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.ui-wn-item__open:hover,
.ui-wn-item__open:focus-visible {
    text-decoration: underline;
}

.ui-wn-item__open i {
    color: inherit;
    font-size: 0.8em;
}

/* The arrow points forward: left in RTL, right in LTR. */
[dir="ltr"] .ui-wn-item__open i {
    transform: scaleX(-1);
}

.ui-wn-modal__head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ui-wn-modal__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--ui-r-md);
    background: var(--ui-tone-primary-soft);
    color: var(--ui-tone-primary-ink);
    font-size: 22px;
}

.ui-wn-modal__icon i {
    color: inherit;
    font-size: inherit;
}

.ui-wn-modal__sub {
    margin-block-start: 2px;
    color: var(--ui-text-2);
    font-size: 13px;
}

.ui-wn-modal__more {
    margin: 1rem 0 0;
    color: var(--ui-text-2);
    font-size: 13px;
}

/* Dropdowns + Metronic menus ------------------------------------------------------- */

.dropdown-menu {
    --bs-dropdown-bg: var(--ui-raised);
    --bs-dropdown-border-color: var(--ui-border);
    --bs-dropdown-border-radius: var(--ui-r-md);
    --bs-dropdown-box-shadow: var(--ui-sh-md);
    --bs-dropdown-link-color: var(--ui-text);
    --bs-dropdown-link-hover-color: var(--ui-text);
    --bs-dropdown-link-hover-bg: var(--ui-hover);
    --bs-dropdown-link-active-color: var(--ui-text);
    --bs-dropdown-link-active-bg: var(--ui-primary-selected);
    box-shadow: var(--bs-dropdown-box-shadow);
}

.menu-sub-dropdown {
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-r-md);
    background-color: var(--ui-raised);
    box-shadow: var(--ui-sh-md);
}

/* Tabs ------------------------------------------------------------------------------ */

.nav-line-tabs {
    border-bottom-color: var(--ui-border);
}

.nav-line-tabs .nav-item .nav-link {
    color: var(--ui-text-2);
    font-weight: 400;
}

.nav-line-tabs .nav-item .nav-link:hover:not(.disabled),
.nav-line-tabs .nav-item .nav-link.active,
.nav-line-tabs .nav-item.show .nav-link {
    border-bottom-color: var(--ui-primary);
    color: var(--ui-text);
    font-weight: 500;
}

.nav-tabs {
    --bs-nav-tabs-border-color: var(--ui-border);
    --bs-nav-tabs-link-hover-border-color: transparent transparent var(--ui-border-strong);
    --bs-nav-tabs-link-active-color: var(--ui-text);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--ui-primary);
}

.nav-tabs .nav-link {
    border-width: 0 0 2px;
    color: var(--ui-text-2);
}

/* Badges ---------------------------------------------------------------------------- */

.badge {
    border-radius: var(--ui-r-sm);
    font-weight: 500;
}

/* Metronic paints light badges with the *fill* colour as text — below AA on the soft
   background. Use each tone's ink instead (ThemeContrastTest holds ink on soft). */
.badge.badge-light-primary { color: var(--ui-tone-primary-ink); }
.badge.badge-light-success { color: var(--ui-tone-success-ink); }
.badge.badge-light-warning { color: var(--ui-tone-warning-ink); }
.badge.badge-light-danger { color: var(--ui-tone-danger-ink); }
.badge.badge-light-info { color: var(--ui-tone-info-ink); }
.badge.badge-light-dark { color: var(--ui-tone-dark-ink); }

.badge.badge-light,
.badge.badge-light-secondary {
    background-color: var(--ui-sunken);
    color: var(--ui-text-2);
}

/* Tables, pagination, tooltips ------------------------------------------------------ */

.table {
    --bs-table-color: var(--ui-text);
    --bs-table-border-color: var(--ui-border-soft);
    --bs-table-hover-bg: var(--ui-row-hover);
    --bs-table-striped-bg: var(--ui-sunken);
}

.page-item .page-link {
    border-radius: var(--ui-r-sm);
    color: var(--ui-text-2);
}

/* Bootstrap rounds only the outer corners of the first and last page (one class more). */
.page-item:first-child .page-link,
.page-item:last-child .page-link {
    border-radius: var(--ui-r-sm);
}

.page-item .page-link:hover {
    background-color: var(--ui-hover);
    color: var(--ui-text);
}

.page-item.active .page-link {
    border-color: var(--ui-primary);
    background-color: var(--ui-primary);
    color: var(--ui-on-fill);
}

/* Metronic sets the dark tooltip fill on `[data-bs-theme=dark] .tooltip:not(.tooltip-inverse)`;
   this selector ties it and loads later. */
[data-bs-theme] .tooltip:not(.tooltip-inverse),
.tooltip:not(.tooltip-inverse) {
    --bs-tooltip-bg: var(--ui-text);
    --bs-tooltip-color: var(--ui-panel);
    --bs-tooltip-border-radius: var(--ui-r-sm);
    --bs-tooltip-font-size: 12px;
}

/* Third-party popups ---------------------------------------------------------------- */

.swal2-popup {
    border-radius: var(--ui-r-lg);
    background: var(--ui-raised);
    color: var(--ui-text);
}

.swal2-popup .swal2-title {
    color: var(--ui-text);
}

.swal2-popup .swal2-html-container {
    color: var(--ui-text-2);
}

/* SweetAlert2 paints its toast white (.swal2-popup.swal2-toast, one class more). */
.swal2-popup.swal2-toast {
    background: var(--ui-raised);
    box-shadow: var(--ui-sh-md);
}

/* IntroJS (introjs.min.css loads after the theme on users/roles/config, hence !important) */
.introjs-tooltip {
    border: 1px solid var(--ui-border) !important;
    border-radius: var(--ui-r-md) !important;
    background-color: var(--ui-raised) !important;
    box-shadow: var(--ui-sh-md) !important;
    color: var(--ui-text) !important;
}

.introjs-tooltip .introjs-tooltiptext,
.introjs-tooltip .introjs-tooltip-title {
    color: var(--ui-text) !important;
}

.introjs-tooltip .introjs-tooltip-header {
    border-bottom: 1px solid var(--ui-border-soft) !important;
    background-color: transparent !important;
}

.introjs-tooltip .introjs-button {
    border: 1px solid var(--ui-border-strong) !important;
    border-radius: var(--ui-r-sm) !important;
    background-color: transparent !important;
    color: var(--ui-text) !important;
    text-shadow: none !important;
}

.introjs-tooltip .introjs-button:hover {
    background-color: var(--ui-hover) !important;
}

.introjs-tooltip .introjs-nextbutton {
    border-color: var(--ui-primary) !important;
    background-color: var(--ui-primary) !important;
    color: var(--ui-on-fill) !important;
}

.introjs-tooltip .introjs-skipbutton {
    color: var(--ui-text-2) !important;
}

.introjs-tooltip .introjs-skipbutton:hover {
    color: var(--ui-text) !important;
}

/* Role modal bulk-actions strip (role/main.js) — carried over from the retired brand stylesheet */
.role-privileges-bulk-card {
    background: var(--ui-tone-success-soft);
}

/* R-14 — a support-case count strip (trainer and management screens): counts only. */
.ui-support-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
    padding: 0.6rem 0.9rem;
    margin-block-end: 0.75rem;
    border: 1px dashed var(--ui-border);
    border-radius: 10px;
    background: var(--ui-panel);
}

.ui-support-strip__label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-inline-end: 0.4rem;
    font-weight: 700;
    color: var(--ui-text);
}

.ui-support-strip__label i {
    color: inherit;
}

.ui-support-strip__link {
    font-weight: 600;
    color: var(--ui-link);
}
