/* Shared modern filter bar (list / tracking pages) */
.app-filter-form,
form.card.mb-3.no-print[method="get"] {
    background: #f8f9fb;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.app-filter-form .app-filter-grid,
form.card.mb-3.no-print[method="get"] .row.align-items-end {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
    margin: 0;
    width: 100%;
}

.app-filter-form .app-filter-field,
.app-filter-form .app-filter-actions,
form.card.mb-3.no-print[method="get"] .col-auto {
    flex: 1 1 150px;
    min-width: 140px;
    max-width: 100%;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.app-filter-form .app-filter-actions,
form.card.mb-3.no-print[method="get"] .col-auto:last-child {
    flex: 0 0 auto;
    min-width: auto;
}

.app-filter-form label,
form.card.mb-3.no-print[method="get"] label.small {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 5px;
    letter-spacing: 0.02em;
    text-align: right;
    line-height: 1.2;
    min-height: 13px;
    white-space: nowrap;
}

.app-filter-form .app-filter-action-label {
    visibility: hidden;
    user-select: none;
    pointer-events: none;
}

.app-filter-form .app-filter-actions-row,
form.card.mb-3.no-print[method="get"] .col-auto:last-child {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    height: 36px;
}

.app-filter-form .form-control,
form.card.mb-3.no-print[method="get"] .form-control {
    width: 100%;
    height: 36px !important;
    min-height: 36px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    padding: 6px 10px;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-filter-form .form-control.form-control-sm,
form.card.mb-3.no-print[method="get"] .form-control.form-control-sm {
    height: 36px !important;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
}

.app-filter-form input[type="date"].form-control {
    padding: 5px 8px;
}

.app-filter-form .form-control:focus,
form.card.mb-3.no-print[method="get"] .form-control:focus {
    border-color: #4680ff;
    box-shadow: 0 0 0 3px rgba(70, 128, 255, 0.12);
}

.app-filter-form select.form-control,
form.card.mb-3.no-print[method="get"] select.form-control {
    min-width: 0;
}

.app-filter-form .app-filter-actions .btn,
form.card.mb-3.no-print[method="get"] .btn {
    height: 36px !important;
    min-height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
    margin: 0;
    box-sizing: border-box;
}

.app-filter-form .app-filter-actions .btn.btn-sm,
form.card.mb-3.no-print[method="get"] .btn.btn-sm {
    height: 36px !important;
    min-height: 36px;
    padding: 0 16px;
    font-size: 13px;
}

.app-filter-form .custom-control,
form.card.mb-3.no-print[method="get"] .custom-control {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding-top: 0;
}

.app-filter-form .custom-control-label,
form.card.mb-3.no-print[method="get"] .custom-control-label {
    font-size: 12px;
    color: #495057;
    padding-top: 2px;
}

/* Select2 inside filter bars */
.app-filter-form .select2-container,
form.card.mb-3.no-print[method="get"] .select2-container {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    vertical-align: top;
}

.app-filter-form .select2-container .select2-selection--single,
form.card.mb-3.no-print[method="get"] .select2-container .select2-selection--single {
    height: 36px !important;
    min-height: 36px !important;
    border: 1px solid #ced4da !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-sizing: border-box !important;
}

.app-filter-form .select2-container--default .select2-selection--single .select2-selection__rendered,
form.card.mb-3.no-print[method="get"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px !important;
    font-size: 13px;
    padding-right: 10px;
    padding-left: 28px;
}

.app-filter-form .select2-container--default .select2-selection--single .select2-selection__arrow,
form.card.mb-3.no-print[method="get"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px !important;
}

.app-filter-form .select2-hidden-accessible,
form.card.mb-3.no-print[method="get"] .select2-hidden-accessible {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

/* Remove nested card padding when legacy markup is used */
form.card.mb-3.no-print[method="get"] > .card-body {
    padding: 0 !important;
    background: transparent;
}

@media (max-width: 576px) {
    .app-filter-form .app-filter-field,
    .app-filter-form .app-filter-actions,
    form.card.mb-3.no-print[method="get"] .col-auto {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .app-filter-form .app-filter-actions-row,
    form.card.mb-3.no-print[method="get"] .col-auto:last-child {
        width: 100%;
    }

    .app-filter-form .app-filter-actions .btn,
    form.card.mb-3.no-print[method="get"] .btn {
        flex: 1 1 auto;
    }
}

/* Role permissions modal — grouped sections */
#modal-define-role .modal-dialog {
    max-width: 960px;
}

.perm-role-select-all {
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #eef2f7;
    border: 1px solid #d5dde8;
    border-radius: 8px;
}

.perm-role-section {
    border: 1px solid #d8dee6;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.perm-role-section-head {
    background: linear-gradient(180deg, #f4f7fb 0%, #e9eef5 100%);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #d8dee6;
}

.perm-role-section-head .custom-control-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e3a5f;
}

.perm-role-section-body {
    padding: 0.85rem 1rem 0.5rem;
    background: #fafbfc;
}

.perm-role-child {
    margin-bottom: 0.65rem;
    min-height: 1.5rem;
}

.perm-role-child .custom-control-label {
    font-size: 0.875rem;
    line-height: 1.45;
    color: #334155;
}

#modal-define-role .modal-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}
