.penalty-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-actions-sticky {
    position: sticky;
    bottom: 0;
    z-index: 25;
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid #d6d9de;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.penalty-card {
    border: 1px solid #d6d9de;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background-color: #fff;
}

.penalty-card.is-marked-for-delete {
    opacity: 0.72;
    background-color: #f8f9fa;
    border-color: #c8ced7;
}

.penalty-field-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    color: #4f5864;
    font-weight: 600;
}

.penalty-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.penalty-notes-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 31px;
    white-space: nowrap;
}

.penalty-notes-toggle .bi {
    font-size: 0.86rem;
}

.penalty-notes-block {
    margin-top: 0.45rem;
}

.penalty-notes-container {
    border-top: 1px dashed #d6d9de;
    padding-top: 0.5rem;
}

.penalty-notes-container.is-collapsed {
    display: none;
}

.penalty-notes-editor .form-control {
    min-height: 2.2rem;
    resize: vertical;
}

.penalty-template-combobox {
    position: relative;
}

.penalty-template-toggle {
    width: 100%;
    min-height: 31px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    text-align: left;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #212529;
    position: relative;
}

.penalty-template-toggle::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 0.25rem solid transparent;
    border-right: 0.25rem solid transparent;
    border-top: 0.3rem solid #495057;
}

.penalty-template-toggle.is-empty {
    color: #6c757d;
}

.penalty-template-combobox.is-open .penalty-template-toggle {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.penalty-template-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 30;
    margin-top: 0.25rem;
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    background: #fff;
    padding: 0.5rem;
    box-shadow: 0 0.4rem 1rem rgba(15, 23, 42, 0.15);
}

.penalty-template-mobile-header {
    display: none;
}

.penalty-template-options {
    margin-top: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.penalty-template-option {
    width: 100%;
    border: 1px solid transparent;
    background: #fff;
    border-radius: 0.35rem;
    text-align: left;
    padding: 0.3rem 0.45rem;
    font-size: 0.875rem;
    line-height: 1.35;
    color: #1f2937;
}

.penalty-template-option:hover:not([disabled]),
.penalty-template-option:focus-visible:not([disabled]) {
    border-color: #bfdbfe;
    background: #eff6ff;
    outline: none;
}

.penalty-template-option.is-highlighted:not([disabled]) {
    border-color: #93c5fd;
    background: #eff6ff;
}

.penalty-template-option.is-active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #0f172a;
    font-weight: 600;
}

.penalty-template-option.is-active.is-highlighted {
    outline: 2px solid #60a5fa;
    outline-offset: -1px;
}

.penalty-template-option.is-disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.penalty-duration-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.penalty-duration-group > * {
    flex: 1 1 6rem;
}

.penalty-duration-group .form-select,
.penalty-duration-group .form-control {
    width: 100%;
    min-width: 0;
}

.penalty-duration-group .form-control[type="number"] {
    min-width: 0;
}

.penalty-card .form-control,
.penalty-card .form-select {
    width: 100%;
}

.penalty-card .penalty-amount-group .form-control {
    min-width: 0;
    max-width: none;
}

.penalty-delete-note {
    border-top: 1px dashed #d8b4b9;
    padding-top: 0.45rem;
}

.inline-formset-item {
    border: 1px solid #d6d9de;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background-color: #fff;
}

.inline-formset-item.is-marked-for-delete {
    opacity: 0.72;
    background-color: #f8f9fa;
    border-color: #c8ced7;
}

.inline-formset-item .form-control,
.inline-formset-item .form-select {
    width: 100%;
}

.inline-delete-note {
    border-top: 1px dashed #d8b4b9;
    padding-top: 0.45rem;
}

@media (max-width: 575.98px) {
    body.template-dropdown-mobile-open {
        overflow: hidden;
    }

    .edit-actions-sticky {
        flex-direction: column;
        align-items: stretch;
    }

    .edit-actions-buttons {
        width: 100%;
    }

    .edit-actions-buttons .btn {
        flex: 1 1 auto;
    }

    .penalty-card,
    .inline-formset-item {
        padding: 0.625rem;
    }

    .penalty-card-actions {
        gap: 0.35rem;
    }

    .penalty-notes-editor .form-control {
        min-height: 2.1rem;
    }

    .penalty-template-dropdown {
        position: fixed;
        inset: 0;
        z-index: 1085;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 0.75rem;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .penalty-template-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .penalty-template-mobile-header strong {
        font-size: 0.95rem;
        color: #1f2937;
    }

    .penalty-template-options {
        margin-top: 0;
        max-height: none;
        min-height: 0;
        flex: 1 1 auto;
        overflow-y: auto;
    }
}
