.modal-dialog {
    margin: 0.5rem auto;
}

.modal-content {
    border: none;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.modal-header {
    padding: 14px 18px !important;
    border-bottom: 1px solid #f0f4fa;
    background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
}

.modal-header .modal-title,
.modal-header h5 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a2b4a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.modal-header .modal-title::before,
.modal-header h5::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #0d6efd 0%, #4f46e5 100%);
    border-radius: 2px;
}

.modal-header .btn-close {
    background-size: 12px;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 14px 18px !important;
    background: #ffffff;
}

.modal-body .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 3px;
}

.modal-body .form-control,
.modal-body .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.86rem;
    color: #1a2b4a;
    background-color: #f8fafc;
    transition: all 0.15s;
    min-height: 34px;
    height: 34px;
    line-height: 1.2;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    background-color: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.08);
    outline: none;
}

.modal-body .form-control::placeholder {
    color: #b0b8c4;
}

.modal-body textarea.form-control {
    min-height: 60px;
    height: auto;
    padding-top: 8px;
    resize: vertical;
}

.modal-body .mb-3 {
    margin-bottom: 10px !important;
}

.modal-body .mb-2 {
    margin-bottom: 8px !important;
}

.modal-body .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 14px;
    font-size: 0.88rem;
    transition: all 0.15s;
    min-height: 38px;
}

.modal-body .btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.modal-body .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
    transform: translateY(-1px);
}

.modal-body .btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.modal-body .btn-success:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.modal-body .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.modal-body .btn-danger:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}

.modal-body .btn-outline-secondary {
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    background: #ffffff;
}

.modal-body .btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.modal-body .btn-outline-danger {
    border: 1.5px solid #fecaca;
    color: #dc2626;
    background: #ffffff;
}

.modal-body .btn-outline-danger:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.modal-body .alert {
    border-radius: 10px;
    border: none;
    font-size: 0.85rem;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.modal-body .alert-light {
    background: #f8fafc;
    color: #475569;
}

.modal-body strong {
    color: #1a2b4a;
    font-weight: 600;
}

.modal-body .row {
    --bs-gutter-x: 8px;
    --bs-gutter-y: 0;
}

.modal-body .col-6,
.modal-body .col-md-6,
.modal-body .col-4,
.modal-body .col-md-4 {
    padding-left: 4px;
    padding-right: 4px;
}

.modal-body .col-6:first-child,
.modal-body .col-md-6:first-child,
.modal-body .col-4:first-child,
.modal-body .col-md-4:first-child {
    padding-left: 0;
}

.modal-body .col-6:last-child,
.modal-body .col-md-6:last-child,
.modal-body .col-4:last-child,
.modal-body .col-md-4:last-child {
    padding-right: 0;
}

@media (max-width: 575.98px) {
    .modal-dialog.modal-fullscreen-sm-down {
        max-width: calc(100% - 24px) !important;
        width: calc(100% - 24px) !important;
        height: auto !important;
        margin: 12px auto !important;
    }
    .modal-dialog.modal-fullscreen-sm-down .modal-content {
        max-height: calc(100vh - 24px - var(--safe-top) - var(--safe-bottom)) !important;
        height: auto !important;
        width: 100% !important;
        border-radius: 16px !important;
        display: flex;
        flex-direction: column;
    }
    .modal-dialog.modal-fullscreen-sm-down .modal-body {
        overflow-y: auto;
        flex: 1;
        min-height: 0;
        padding: 12px 14px !important;
    }
    .modal-dialog.modal-fullscreen-sm-down .modal-header {
        padding: 12px 14px !important;
        border-radius: 16px 16px 0 0 !important;
    }
    .modal-dialog.modal-fullscreen-sm-down .modal-header .modal-title,
    .modal-dialog.modal-fullscreen-sm-down .modal-header h5 {
        font-size: 0.95rem;
    }
    .modal-body .form-control,
    .modal-body .form-select {
        font-size: 0.84rem;
        padding: 5px 9px;
        min-height: 32px;
        height: 32px;
    }
    .modal-body textarea.form-control {
        min-height: 56px;
        height: auto;
    }
    .modal-body .mb-3 {
        margin-bottom: 8px !important;
    }
    .modal-body .form-label {
        font-size: 0.74rem;
    }
    .modal-body .row.g-2 {
        --bs-gutter-x: 6px;
    }
    .modal-body .row.g-2 > .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding-left: 3px;
        padding-right: 3px;
    }
    .modal-body .row.g-2 > .col-6:first-child {
        padding-left: 0;
    }
    .modal-body .row.g-2 > .col-6:last-child {
        padding-right: 0;
    }
    .modal-body .row.g-2 > .col-6 .form-label {
        font-size: 0.72rem;
        margin-bottom: 2px;
    }
    .modal-body .row.g-2 > .col-6 .form-select,
    .modal-body .row.g-2 > .col-6 .form-control {
        font-size: 0.78rem;
        padding: 4px 6px;
        min-height: 30px;
        height: 30px;
    }
    .modal-dialog.modal-dialog-fit {
        max-width: calc(100% - 32px) !important;
        width: calc(100% - 32px) !important;
        height: 100% !important;
        margin: 0 auto !important;
        min-height: unset !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: calc(16px + var(--safe-top)) 0 calc(16px + var(--safe-bottom)) 0;
        box-sizing: border-box;
    }
    .modal-dialog.modal-dialog-fit .modal-content {
        width: 100%;
        height: auto !important;
        max-height: 80vh;
        border-radius: 14px !important;
        overflow: hidden;
        padding-bottom: 0 !important;
        margin: 0;
    }
    .modal-dialog.modal-dialog-fit .modal-body {
        padding: 14px;
        overflow-y: auto;
    }
    .modal-dialog.modal-dialog-fit .modal-header {
        padding-top: 14px !important;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }
}