.app-alert-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.app-alert {
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.28);
    color: #fff;
    padding: 1rem;
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 0.9rem;
    backdrop-filter: blur(18px);
    transform: translateY(18px) scale(0.98);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.app-alert.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.app-alert__icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.app-alert__content {
    min-width: 0;
}

.app-alert__title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}

.app-alert__title {
    display: block;
    font-size: 0.98rem;
    line-height: 1.2;
}

.app-alert__message {
    margin-top: 0.35rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.9);
}

.app-alert__message ul {
    margin: 0.3rem 0 0;
    padding-left: 1.15rem;
}

.app-alert__close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1.35rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.app-alert__close:hover {
    color: #fff;
}

.app-alert--success {
    background: linear-gradient(135deg, rgba(15, 157, 88, 0.96), rgba(21, 128, 61, 0.95));
}

.app-alert--error {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.97), rgba(185, 28, 28, 0.95));
}

.app-alert--warning {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.97), rgba(180, 83, 9, 0.95));
}

.app-alert--info {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.97), rgba(29, 78, 216, 0.95));
}

.ajax-loading {
    opacity: 0.65;
}

.ajax-loading .form-control,
.ajax-loading .form-select,
.ajax-loading .btn,
.ajax-loading button {
    pointer-events: none;
}

.notification-dropdown {
    position: relative;
}

.notification-bell-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.notification-bell-btn:hover,
.notification-bell-btn.show {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.notification-bell-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.notification-dropdown .notification-dropdown-menu {
    width: min(390px, 92vw);
    margin-top: 0.75rem;
    padding: 0;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.notification-dropdown-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.notification-dropdown-header strong {
    display: block;
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.2;
}

.notification-dropdown-header small {
    display: block;
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.78rem;
}

.notification-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #eef2ff;
    color: #4338ca;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.notification-link-btn:hover {
    border-color: #4338ca;
    background: #e0e7ff;
}

.notification-list {
    display: grid;
    gap: 0.75rem;
    max-height: 430px;
    overflow-y: auto;
    padding: 0.85rem;
    background: #f8fafc;
}

.notification-empty {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding: 1.4rem 1rem;
    color: #64748b;
    text-align: center;
}

.notification-empty i {
    color: #2563eb;
    font-size: 1.4rem;
}

.notification-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 0.75rem;
    align-items: start;
    padding: 0.85rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.notification-item-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
}

.notification-item-body {
    min-width: 0;
}

.notification-item-title {
    display: block;
    color: #1d4ed8;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.25;
    text-decoration: none;
}

.notification-item-title:hover {
    color: #123ea5;
    text-decoration: underline;
}

.notification-item-message {
    margin-top: 0.25rem;
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.45;
    word-break: break-word;
}

.notification-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.45rem;
    color: #64748b;
    font-size: 0.75rem;
}

.notification-item-meta span,
.notification-item-meta a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.notification-item-meta a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.notification-item-meta a:hover {
    text-decoration: underline;
}

.notification-read-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.notification-read-btn:hover {
    border-color: #16a34a;
    background: #dcfce7;
    color: #15803d;
}

.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.table-actions--start {
    justify-content: flex-start;
}

.table-actions--end {
    justify-content: flex-end;
}

.app-action {
    --action-bg: #ffffff;
    --action-border: #d9e1ec;
    --action-color: #243447;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.52rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--action-border);
    background: var(--action-bg);
    color: var(--action-color);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.app-action:hover {
    transform: translateY(-1px);
    color: var(--action-color);
    border-color: color-mix(in srgb, var(--action-border) 75%, #111827 25%);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

.app-action i {
    font-size: 0.82rem;
}

.app-action--edit {
    --action-bg: #fff7ed;
    --action-border: #fed7aa;
    --action-color: #9a3412;
}

.app-action--delete {
    --action-bg: #fff1f2;
    --action-border: #fecdd3;
    --action-color: #b42318;
}

.app-action--view {
    --action-bg: #f9fafb;
    --action-border: #d1d5db;
    --action-color: #374151;
}

.app-action--manage,
.app-action--primary {
    --action-bg: #fff0ef;
    --action-border: #ffd8d5;
    --action-color: #ef3b32;
}

.app-action--confirm,
.app-action--success {
    --action-bg: #ecfdf3;
    --action-border: #b7ebc6;
    --action-color: #15803d;
}

.app-action--warning,
.app-action--status {
    --action-bg: #fff8e6;
    --action-border: #f7d58a;
    --action-color: #9a6700;
}

.app-action--secondary {
    --action-bg: #f9fafb;
    --action-border: #e5e7eb;
    --action-color: #374151;
}

.modal .modal-dialog {
    padding: 0.75rem;
}

.modal .modal-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

.modal .modal-header {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid #e7edf5;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.modal .modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: 0.01em;
}

.modal .modal-body {
    padding: 1.35rem;
    background: #fff;
}

.modal .modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.35rem;
    border-top: 1px solid #e7edf5;
    background: #f8fafc;
}

.modal .btn-close {
    opacity: 0.7;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.modal .btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.modal .form-label {
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.45rem;
}

.modal .row.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.modal-backdrop.show {
    opacity: 0.56;
}

.app-pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
    padding: 0.5rem 0 0.25rem;
}

.app-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.app-pagination .page-link {
    min-width: 40px;
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: #8b95a1;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-pagination .page-link:hover {
    color: #ef3b32;
    background: #fff0ef;
    box-shadow: none;
}

.app-pagination .page-item.active .page-link {
    width: 40px;
    height: 40px;
    background: #ef3b32;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(239, 59, 50, 0.22);
}

.app-pagination .page-item.disabled .page-link,
.app-pagination .page-item.disabled .page-link:hover {
    background: transparent;
    color: #b6bdc7;
    box-shadow: none;
}

.app-pagination__ellipsis {
    pointer-events: none;
}

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

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: 46px;
    border: 1.5px solid #ffc107 !important;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: none;
    transition: 0.3s ease;
    font-size: 14px;
    font-style: italic;
}

.select2-container .select2-selection--single:hover,
.select2-container .select2-selection--multiple:hover {
    border-color: #ffca2c !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.16);
}

.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 44px;
    padding-left: 14px;
    padding-right: 2.4rem;
    color: #212529;
    font-size: 14px;
    font-style: italic;
}

.select2-container .select2-selection--single .select2-selection__placeholder,
.select2-container .select2-selection--multiple .select2-selection__placeholder {
    color: #6c757d;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 44px;
    right: 0.7rem;
}

.select2-container .select2-selection--multiple {
    padding: 10px 14px;
}

.select2-container .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0;
}

.select2-container .select2-selection--multiple .select2-selection__choice {
    margin: 0;
    padding: 0.32rem 0.7rem 0.32rem 1.5rem;
    border: 1px solid #d5e3fb;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 700;
}

.select2-container .select2-selection--multiple .select2-selection__choice__remove {
    left: 0.45rem;
    right: auto;
    border-right: none;
    color: #1d4ed8;
    font-weight: 700;
}

.select2-container .select2-search--inline .select2-search__field {
    margin-top: 0;
    font-size: 14px;
    font-family: inherit;
    font-style: italic;
}

.select2-dropdown {
    border: 1px solid #d8e0ea;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #d1dae6;
    border-radius: 0.75rem;
    padding: 0.55rem 0.8rem;
}

.select2-results__option {
    padding: 0.68rem 0.9rem;
    font-size: 0.92rem;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: #eef4ff;
    color: #1d4ed8;
}

.select2-container--default .select2-results__option--selected {
    background: #f8fafc;
    color: #334155;
}

.select2-container.app-select2--invalid .select2-selection--single,
.select2-container.app-select2--invalid .select2-selection--multiple {
    border-color: #dc3545;
}

.select2-container.app-select2--sm .select2-selection--single,
.select2-container.app-select2--sm .select2-selection--multiple {
    min-height: 38px;
    border-radius: 0.6rem;
}

.select2-container.app-select2--sm .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    font-size: 0.84rem;
}

.select2-container.app-select2--sm .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.app-password-toggle-group .form-control {
    border-right: 0;
}

.app-password-toggle-group .app-password-toggle {
    min-width: 48px;
    border-color: #ffc107;
    border-left: 0;
    color: #475569;
    background: #fff;
}

.app-password-toggle-group .app-password-toggle:hover,
.app-password-toggle-group .app-password-toggle:focus {
    color: #1d4ed8;
    background: #f8fbff;
    border-color: #ffca2c;
    box-shadow: none;
}

.app-password-toggle-group .form-control:focus + .app-password-toggle {
    border-color: #86b7fe;
}

.flatpickr-calendar {
    border: 1px solid #e3e8f2;
    border-radius: 1.15rem;
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.16);
    padding: 0.45rem 0.5rem 0.55rem;
    background: #ffffff;
}

.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
    display: none;
}

.flatpickr-months {
    margin-bottom: 0.25rem;
}

.flatpickr-months .flatpickr-month {
    height: 52px;
    background: transparent;
}

.flatpickr-current-month {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: calc(100% - 88px);
    left: 44px;
    padding-top: 0.7rem;
    color: #334155;
    font-size: 0.98rem;
    font-weight: 700;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: #334155;
    font-weight: 700;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    flex: 0 1 auto;
    max-width: 58%;
    min-width: 0;
    padding: 0.1rem 1.6rem 0.1rem 0.35rem;
    border-radius: 0.65rem;
}

.flatpickr-current-month .numInputWrapper {
    flex: 0 0 72px;
    width: 72px;
}

.flatpickr-current-month input.cur-year {
    width: 100%;
    min-width: 72px;
    border-radius: 0.65rem;
    padding: 0.1rem 0.35rem;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month input.cur-year:hover,
.flatpickr-current-month .flatpickr-monthDropdown-months:focus,
.flatpickr-current-month input.cur-year:focus {
    background: #f8fbff;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    top: 0.55rem;
    width: 36px;
    height: 36px;
    padding: 0.45rem;
    border-radius: 999px;
    color: #475569;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: #f8fbff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    width: 14px;
    height: 14px;
}

.flatpickr-weekdays {
    background: #fff7db;
    border-radius: 0.9rem;
    margin: 0 0.2rem 0.35rem;
    padding: 0.2rem 0;
}

span.flatpickr-weekday {
    color: #5b6472;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.flatpickr-days {
    width: 100%;
}

.dayContainer {
    min-width: 100%;
    max-width: 100%;
    justify-content: space-between;
    gap: 0.15rem 0;
    padding: 0.1rem 0.15rem 0;
}

.flatpickr-day {
    max-width: none;
    width: 38px;
    height: 38px;
    line-height: 38px;
    margin: 1px 0;
    border-radius: 999px;
    border: 1px solid transparent;
    color: #334155;
    font-weight: 500;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: #eef4ff;
    border-color: #cfe0ff;
    color: #1d4ed8;
}

.flatpickr-day.today {
    border-color: #f0cc57;
    color: #946200;
    background: #fff8dc;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: linear-gradient(135deg, #d9c14d, #f0dc84);
    border-color: #d9c14d;
    color: #1f2937;
    box-shadow: 0 10px 20px rgba(217, 193, 77, 0.28);
}

.flatpickr-day.inRange {
    background: #fff6cf;
    border-color: #fff6cf;
    box-shadow: none;
    color: #6b7280;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay,
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: #c0c8d4;
}

@media (max-width: 640px) {
    .app-alert-stack {
        left: 1rem;
        right: 1rem;
        width: auto;
    }

    .table-actions {
        width: 100%;
    }

    .app-action {
        flex: 1 1 calc(50% - 0.5rem);
    }

    .modal .modal-dialog {
        padding: 0.35rem;
    }

    .modal .modal-body,
    .modal .modal-header,
    .modal .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .app-pagination .page-link {
        min-width: 38px;
        min-height: 38px;
        padding: 0.45rem 0.72rem;
        font-size: 0.84rem;
    }
}
