.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--color-bg-amoled);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 95%;
    padding: 0;
    position: relative;
    animation: modalSlideUp 0.3s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: 0.2s;
    z-index: 2001;
}

.modal-close:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    padding: 1.5rem 2rem 0.5rem;
    margin-bottom: 0;
    color: var(--color-text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 2rem;
    flex-grow: 1;
}

.modal-fields-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 2rem;
    padding: 1.5rem 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.notes-group {
    grid-column: 1 / span 2;
}
.form-group.checkbox-group {
    grid-column: 3 / 4;
    align-self: flex-end;
    margin-bottom: 0.5rem;
}
.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    background: var(--color-bg-field);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--color-text-primary);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

.notes-textarea {
    resize: vertical;
    min-height: 100px;
}

.date-group {
    display: flex;
    gap: 1rem;
}

.date-input-pair {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--color-bg-base);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.form-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.form-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0;
    justify-content: flex-end;
    flex-shrink: 0;
    padding: 1rem 2rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: var(--color-bg-amoled);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    margin-right: auto;
}

.btn-danger:hover {
    opacity: 0.9;
}

.modal-overlay {
    display: none;
    opacity: 0;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}

@media (max-width: 900px) {
    .modal-content {
        max-width: 95%;
    }
    .modal-fields-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-group.notes-group {
        grid-column: 1 / -1;
    }
    .form-group.checkbox-group {
        grid-column: 1 / -1;
        align-self: auto;
    }
    .modal-actions {
        padding: 1rem 1.5rem;
    }
    .modal-title, .modal-body {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

